def METHOD_NAME(
    self,
    df: pd.DataFrame,
    batch_spec: BatchSpec,
) -> pd.DataFrame:
    """Take a random sample of rows, retaining proportion p.
    Args:
        df: dataframe to sample
        batch_spec: Can contain key `p` (float) which defaults to 0.1
            if not provided.
    Returns:
        Sampled dataframe
    Raises:
        SamplerError
    """
    p: float = self.get_sampling_kwargs_value_or_default(
        batch_spec=batch_spec, sampling_kwargs_key="p", default_value=0.1
    )
    return df[df.index.map(lambda x: random.random() < p)]