code: def get_python_method_type(py_function):
      # given a python class method, parse the annotations to figure out the type
      function_inputs = []
      function_output = get_type_info(void)
      annotations = {}
      if hasattr(py_function, "type_annotations"):
          annotations = {
              k: get_type_info(v)
              for k, v in py_function.type_annotations.items()
          }
      if hasattr(py_function, "return_type"):
          function_output = get_type_info(py_function.return_type)
      try:
          if hasattr(py_function, "__func__"):
              argcount = py_function.__func__.__code__.co_argcount
              argnames = py_function.__func__.__code__.co_varnames[
                  :argcount
              ]
          else:
              argcount = py_function.__code__.co_argcount
              argnames = py_function.__code__.co_varnames[:argcount]
      except:
          raise TypeError(
              "Unable to derive type information from method %s. "
              "You might have a misspecified type. Ex: use compyler.int and not int"
              % py_function
          )
  
      for arg in argnames:
          if arg in annotations:
              function_inputs.append(annotations[arg])
          elif arg != "self":
              raise TypeError(
                  "Function "
                  + str(py_function)
                  + " insufficient annotations. "
                  + arg
                  + " needs a type"
              )
      typeinfo = FunctionType(
          function_inputs, function_output, py_function
      )
      return typeinfo
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/types/get_type_info.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from .type_spec import *
  from .type_void import void
label_desc: Use image node_id 1 for calling a global function with example usage: get_python_method_type(py_function) and returns: typeinfo