def METHOD_NAME(dataframe, name_filter):
    """Prepare a DataFrame for plotting."""
    dataframe = dataframe[dataframe.name.str.contains(name_filter)]
    if dataframe.empty:
        raise ValueError(f'No benchmarks with name {name_filter.pattern}')
    dataframe['aggregate'] = dataframe.name.map(
        lambda full_name: NAME_PATTERN.match(full_name)['aggregate']
    )
    dataframe.name = dataframe.name.map(
        lambda full_name: NAME_PATTERN.match(full_name)['name']
    )
    process_errors(dataframe)
    time_units = dataframe['time_unit'].unique()
    if time_units != ['ns']:
        raise NotImplementedError(f'Unsupported time units: {time_units}')
    return dataframe