code: def is_valid_name_error(name: str, node: Node = None) -> Optional[GraphQLError]:
      
      if not isinstance(name, str):
          raise TypeError("Expected string")
      if name.startswith("__"):
          return GraphQLError(
              f"Name {name!r} must not begin with '__',"
              " which is reserved by GraphQL introspection.",
              node,
          )
      if not re_name.match(name):
          return GraphQLError(
              f"Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but {name!r} does not.", node
          )
      return None
docs: Return an Error if a name is invalid.