def get_data_matching_filter(filter_by, raw_data):
    """
    Returns a list of data matching filter_by from a given STB's raw_data
    :param filter_by: Tuple containing (filter_name, filter_value)
    :param raw_data: Dictionary of raw stb_data for 1 STB.
    :return: List of dictionary entries from flattened STB matching filter.
    """
    result = []
    # If there is no filter, then return all data from this STB.
    filter_name, filter_value = filter_by if filter_by else ('stb', raw_data['stb'])

    # Flatten the data structure and filter desired results
    for date in (keys for keys in raw_data if keys not in ['stb']):
        for title in raw_data[date]:
            entry = {
                'stb': raw_data['stb'],
                'date': date,
                'title': title,
                'provider': raw_data[date][title]['provider'],
                'rev': raw_data[date][title]['rev'],
                'time': raw_data[date][title]['time']
            }
            # If the entry matches the filter, add flattened data to the result list
            result += [entry] if entry[filter_name] == filter_value else []

    return result