code: def _create_union_types_specification(schema_graph, graphql_types, hidden_classes, base_name):
      
      # When edges point to vertices of type base_name, and base_name is both non-abstract and
      # has subclasses, we need to represent the edge endpoint type with a union type based on
      # base_name and its subclasses. This function calculates what types that union should include.
      def types_spec():
          """Return a list of GraphQL types that this class' corresponding union type includes."""
          return [
              graphql_types[x]
              for x in sorted(list(schema_graph.get_subclass_set(base_name)))
              if x not in hidden_classes
          ]
  
      return types_spec
docs: Return a function that gives the types in the union type rooted at base_name.