code: def _get_fields(ast):
      
      if not ast.selection_set:
          # There are no child fields.
          return [], []
  
      property_fields = []
      vertex_fields = []
      seen_field_names = set()
      switched_to_vertices = False  # Ensures that all property fields are before all vertex fields.
      for field_ast in ast.selection_set.selections:
          if not isinstance(field_ast, Field):
              # We are getting Fields only, ignore everything else.
              continue
  
          name = get_ast_field_name(field_ast)
          if name in seen_field_names:
              # If we ever allow repeated field names,
              # then we have to change the Location naming scheme to reflect the repetitions
              # and disambiguate between Recurse and Traverse visits to a Location.
              raise GraphQLCompilationError(u'Encountered repeated field name: {}'.format(name))
          seen_field_names.add(name)
  
          # Vertex fields start with 'out_' or 'in_', denoting the edge direction to that vertex.
          if is_vertex_field_name(name):
              switched_to_vertices = True
              vertex_fields.append(field_ast)
          else:
              if switched_to_vertices:
                  raise GraphQLCompilationError(u'Encountered property field {} '
                                                u'after vertex fields!'.format(name))
              property_fields.append(field_ast)
  
      return vertex_fields, property_fields
docs: Return a list of vertex fields, and a list of property fields, for the given AST node.
  
      Also verifies that all property fields for the AST node appear before all vertex fields,
      raising GraphQLCompilationError if that is not the case.
  
      Args:
          ast: GraphQL AST node, obtained from the graphql library
  
      Returns:
          tuple of two lists
              - the first list contains ASTs for vertex fields
              - the second list contains ASTs for property fields