def filter_profile(data, profile):
    """
    Take a dataframe after it has been processed by merge_data, and a profile
    and returns a filtered dataframe of players with that profile. Valid profiles
    are 'long_inaccurate', 'long_accurate', 'short_inaccurate', 'short_inaccurate'.
    """
    player_aggregates = data[data['Date'] == '2019-08-25']
    if profile == 'long_inaccurate':
        acc_thresh = 55
        dist_thresh = 300
        criteria = (player_aggregates['Distance'] > dist_thresh) & (player_aggregates['Accuracy (%)'] < acc_thresh)

    elif profile == 'long_accurate':
        acc_thresh = 65
        dist_thresh = 300
        criteria = (player_aggregates['Distance'] > dist_thresh) & (player_aggregates['Accuracy (%)'] > acc_thresh)
    elif profile == 'short_inaccurate':
        acc_thresh = 60
        dist_thresh = 290
        criteria = (player_aggregates['Distance'] < dist_thresh) & (player_aggregates['Accuracy (%)'] < acc_thresh)
    elif profile == 'short_accurate':
        acc_thresh = 70
        dist_thresh = 280
        criteria = (player_aggregates['Distance'] < dist_thresh) & (player_aggregates['Accuracy (%)'] > acc_thresh)
    else:
        return 'Error: enter valid profile'
    filtered = player_aggregates[criteria]
    result = data[data['Player Name'].isin(filtered['Player Name'])]
    return result