def _construct_location_to_filter_list(match_query):
    """Return a dict mapping location -> list of filters applied at that location.

    Args:
        match_query: MatchQuery object from which to extract location -> filters dict

    Returns:
        dict mapping each location in match_query to a list of
            Filter objects applied at that location
    """
    # For each location, all filters for that location should be applied at the first instance.
    # This function collects a list of all filters corresponding to each location
    # present in the given MatchQuery.
    location_to_filters = {}
    for match_traversal in match_query.match_traversals:
        for match_step in match_traversal:
            current_filter = match_step.where_block
            if current_filter is not None:
                current_location = match_step.as_block.location
                location_to_filters.setdefault(current_location, []).append(
                    current_filter)

    return location_to_filters