Conditionally sample example from the dataset

How how to conditionally sample example from the dataset. Eg dataset.sample(‘id’==‘abc’)?

This is also referred to as filtering the dataset, docs can be found here: Main classes — datasets 1.15.1 documentation