code: def _get_present_locations(match_traversals):
      
      present_locations = set()
      present_non_optional_locations = set()
  
      for match_traversal in match_traversals:
          for step in match_traversal:
              if step.as_block is not None:
                  location_name, _ = step.as_block.location.get_location_name()
                  present_locations.add(location_name)
                  if isinstance(step.root_block, Traverse) and not step.root_block.optional:
                      present_non_optional_locations.add(location_name)
  
      if not present_non_optional_locations.issubset(present_locations):
          raise AssertionError(u'present_non_optional_locations {} was not a subset of '
                               u'present_locations {}. THis hould never happen.'
                               .format(present_non_optional_locations, present_locations))
  
      return present_locations, present_non_optional_locations
docs: Return the set of locations and non-optional locations present in the given match traversals.
  
      When enumerating the possibilities for optional traversals,
      the resulting match traversals may have sections of the query omitted.
      These locations will not be included in the returned `present_locations`.
      All of the above locations that are not optional traverse locations
      will be included in present_non_optional_locations.
  
      Args:
          match_traversals: one possible list of match traversals generated from a query
                            containing @optional traversal(s)
  
      Returns:
          tuple (present_locations, present_non_optional_locations):
          - present_locations: set of all locations present in the given match traversals
          - present_non_optional_locations: set of all locations present in the match traversals
                                            that are not reached through optional traverses.
                                            Guaranteed to be a subset of present_locations.