def filter_time(
    df: pd.DataFrame,
    start: Union[datetime, None] = None,
    end: Union[datetime, None] = None,
) -> pd.DataFrame:
    """
    Filter time series data based on start and end date
    """

    # Get time index
    time = df.index.get_level_values("time")

    # Filter & return
    return df.loc[(time >= start) & (time <= end)] if start and end else df

    Filter time series data based on start and end date
    
meteostat/utilities/mutations.py