nodes: 0, module; 1, function_definition; 2, function_name:get_suggested_type_names; 3, parameters; 4, block; 5, identifier:schema; 6, identifier:output_type; 7, identifier:field_name; 8, expression_statement; 9, if_statement; 10, comment:# Otherwise, must be an Object type, which does not have possible fields.; 11, return_statement; 12, comment:"""Go through all of the implementations of type, as well as the interfaces
        that they implement. If any of those types include the provided field,
        suggest them, sorted by how often the type is referenced,  starting
        with Interfaces."""; 13, call; 14, block; 15, list; 16, identifier:isinstance; 17, argument_list; 18, expression_statement; 19, expression_statement; 20, for_statement; 21, comment:# Suggest interface types based on how common they are.; 22, expression_statement; 23, comment:# Suggest both interface and object types.; 24, expression_statement; 25, return_statement; 26, identifier:output_type; 27, tuple; 28, assignment; 29, assignment; 30, identifier:possible_type; 31, call; 32, block; 33, assignment; 34, call; 35, identifier:suggested_interface_types; 36, identifier:GraphQLInterfaceType; 37, identifier:GraphQLUnionType; 38, identifier:suggested_object_types; 39, list; 40, identifier:interface_usage_count; 41, call; 42, attribute; 43, argument_list; 44, if_statement; 45, comment:# This object type defines this field.; 46, expression_statement; 47, for_statement; 48, identifier:suggested_interface_types; 49, call; 50, attribute; 51, argument_list; 52, identifier:OrderedDict; 53, argument_list; 54, identifier:schema; 55, identifier:get_possible_types; 56, identifier:output_type; 57, not_operator; 58, block; 59, call; 60, identifier:possible_interface; 61, attribute; 62, block; 63, identifier:sorted; 64, argument_list; 65, identifier:suggested_interface_types; 66, identifier:extend; 67, identifier:suggested_object_types; 68, call; 69, return_statement; 70, attribute; 71, argument_list; 72, identifier:possible_type; 73, identifier:interfaces; 74, if_statement; 75, comment:# This interface type defines this field.; 76, expression_statement; 77, call; 78, keyword_argument; 79, keyword_argument; 80, attribute; 81, argument_list; 82, identifier:suggested_object_types; 83, identifier:append; 84, attribute; 85, not_operator; 86, block; 87, assignment; 88, identifier:list; 89, argument_list; 90, identifier:key; 91, lambda; 92, identifier:reverse; 93, True; 94, attribute; 95, identifier:get; 96, identifier:field_name; 97, identifier:possible_type; 98, identifier:name; 99, call; 100, continue_statement; 101, subscript; 102, parenthesized_expression; 103, call; 104, lambda_parameters; 105, subscript; 106, identifier:possible_type; 107, identifier:fields; 108, attribute; 109, argument_list; 110, identifier:interface_usage_count; 111, attribute; 112, binary_operator:interface_usage_count.get(possible_interface.name, 0) + 1; 113, attribute; 114, argument_list; 115, identifier:k; 116, identifier:interface_usage_count; 117, identifier:k; 118, attribute; 119, identifier:get; 120, identifier:field_name; 121, identifier:possible_interface; 122, identifier:name; 123, call; 124, integer:1; 125, identifier:interface_usage_count; 126, identifier:keys; 127, identifier:possible_interface; 128, identifier:fields; 129, attribute; 130, argument_list; 131, identifier:interface_usage_count; 132, identifier:get; 133, attribute; 134, integer:0; 135, identifier:possible_interface; 136, identifier:name
code: def get_suggested_type_names(schema, output_type, field_name):
      """Go through all of the implementations of type, as well as the interfaces
        that they implement. If any of those types include the provided field,
        suggest them, sorted by how often the type is referenced,  starting
        with Interfaces."""
  
      if isinstance(output_type, (GraphQLInterfaceType, GraphQLUnionType)):
          suggested_object_types = []
          interface_usage_count = OrderedDict()
          for possible_type in schema.get_possible_types(output_type):
              if not possible_type.fields.get(field_name):
                  return
  
              # This object type defines this field.
              suggested_object_types.append(possible_type.name)
  
              for possible_interface in possible_type.interfaces:
                  if not possible_interface.fields.get(field_name):
                      continue
  
                  # This interface type defines this field.
                  interface_usage_count[possible_interface.name] = (
                      interface_usage_count.get(possible_interface.name, 0) + 1
                  )
  
          # Suggest interface types based on how common they are.
          suggested_interface_types = sorted(
              list(interface_usage_count.keys()),
              key=lambda k: interface_usage_count[k],
              reverse=True,
          )
  
          # Suggest both interface and object types.
          suggested_interface_types.extend(suggested_object_types)
          return suggested_interface_types
  
      # Otherwise, must be an Object type, which does not have possible fields.
      return []