def max_duration(df, max_seconds=5.0):
    """Maximum duration

    Helper predicate for sample validation

    Parameters
    ----------
    df : pandas.DataFrame
        DataFrame containing the measurements for this window
    max_seconds : float
        The maximal time difference for the measurements

    Returns
    -------
    bool
        True if the duration of `df` is less than `max_seconds`
    """
    duration = df.index.max().to_pydatetime() - df.index.min().to_pydatetime()
    return duration.total_seconds() < max_seconds
