Lower Expressons involving non-existent ContextFields.

def lower_context_field_expressions(compound_match_query):
    """Lower Expressons involving non-existent ContextFields."""
    if len(compound_match_query.match_queries) == 0:
        raise AssertionError(u'Received CompoundMatchQuery {} with no MatchQuery objects.'
                             .format(compound_match_query))
    elif len(compound_match_query.match_queries) == 1:
        # All ContextFields exist if there is only one MatchQuery
        # becuase none of the traverses were omitted, and all locations exist (are defined).
        return compound_match_query
    else:
        new_match_queries = []
        for match_query in compound_match_query.match_queries:
            match_traversals = match_query.match_traversals
            present_locations, _ = _get_present_locations(match_traversals)
            current_visitor_fn = partial(_update_context_field_expression, present_locations)

            new_match_traversals = _lower_non_existent_context_field_filters(
                match_traversals, current_visitor_fn)
            new_match_queries.append(
                MatchQuery(
                    match_traversals=new_match_traversals,
                    folds=match_query.folds,
                    output_block=match_query.output_block,
                    where_block=match_query.where_block,
                )
            )

    return CompoundMatchQuery(match_queries=new_match_queries)