code: def check_fn(fn, loc):
      # Make sure the function definition is not a class instantiation
      try:
          source = dedent("".join(get_source_lines_and_file(fn)[0]))
      except (OSError, TypeError):
          return
      if source is None:
          return
  
      py_ast = ast.parse(source)
      if len(py_ast.body) == 1 and isinstance(
          py_ast.body[0], ast.ClassDef
      ):
          raise torch.jit.frontend.FrontendError(
              loc,
              f"Cannot instantiate class '{py_ast.body[0].name}' in a script function",
          )
      if len(py_ast.body) != 1 or not isinstance(
          py_ast.body[0], ast.FunctionDef
      ):
          raise torch.jit.frontend.FrontendError(
              loc, "Expected a single top-level function"
          )
  
imports: import ast
  import builtins
  import dis
  import enum
  import inspect
  import re
  import typing
  import warnings
  from textwrap import dedent
  from typing import Type
  import torch
  from torch._C import _GeneratorType, AnyType, AwaitType, BoolType, ComplexType, DeviceObjType, DictType, EnumType, FloatType, FutureType, InterfaceType, IntType, ListType, NoneType, NumberType, OptionalType, StreamObjType, StringType, TensorType, TupleType, UnionType
  from torch._sources import get_source_lines_and_file
  from .._jit_internal import _Await, _qualified_name, Any, BroadcastingList1, BroadcastingList2, BroadcastingList3, Dict, Future, is_await, is_dict, is_future, is_ignored_fn, is_list, is_optional, is_tuple, is_union, List, Optional, Tuple, Union
  from ._state import _get_script_class
  from torch._ops import OpOverloadPacket
label_desc: Use image node_id 5 for calling a global function with example usage: check_fn(fn, loc) without return types