def filter_near_diagonal(df, distance=24000, drop=True):
    """
    Drops rows from df where its 'distance' column is less than k.

    Dropping occurs in-place.

    Parameters
    ----------
    df : pd.DataFrame
        Must have a 'distance' column.
    distance : int
        Threshold for distance (in bp).
    drop : bool
        Pass True to drop the filtered rows in-place. Pass False to return an
        index subset for the filtered rows instead.
    """
    index_subset = df[df['distance'] < distance].index
    if drop:
        df.drop(index_subset, inplace=True)
    else:
        return index_subset
