code: def visit_function_def(self: Parser, node: doc.FunctionDef) -> None:
      """The function definition visiting method for tir.
  
      Parameters
      ----------
      self : Parser
          The visiting parser.
  
      node : doc.FunctionDef
          The doc AST function definition node.
      """
      supplied_annotation = self.function_annotations
      func_annotation = supplied_annotation.get(node.name, {})
      privacy = find_decorator_annotation(
          node, "private", default=False
      )
      self.function_annotations = None
      with self.var_table.with_frame():
          self.var_table.add("range", T.serial)
          with T.prim_func(is_private=privacy):
              T.func_name(node.name)
              if node.returns is not None:
                  ret_type = self.eval_expr(node.returns)
                  if callable(ret_type):
                      ret_type = PrimType(ret_type().dtype)
                  T.func_ret(ret_type)
              with self.with_dispatch_token("tir"):
                  # TODO: handle different types of arguments:
                  # - vararg: arg | None
                  # - kwonlyargs: list[arg]
                  # - kw_defaults: list[expr | None]
                  # - kwarg: arg | None
                  # - defaults: list[expr]
                  # - posonlyargs: list[arg]
                  for arg in node.args.args:
                      if arg.annotation is None:
                          self.report_error(
                              arg,
                              "Type annotation required for function parameters.",
                          )
                      try:
                          ann = self.eval_expr(arg.annotation)
                          if callable(ann):
                              ann = ann()
                      except Exception:  # pylint: disable=broad-except
                          ann = func_annotation.get(arg.arg, None)
                          if ann is None:
                              raise
                      param = T.arg(arg.arg, ann)
                      self.var_table.add(arg.arg, param)
                  self.visit_body(node.body)
      self.function_annotations = supplied_annotation
  
imports: import contextlib
  from functools import partial
  from typing import Any
  import tvm
  from tvm.ir import GlobalVar, PrimType
  from tvm.tir import Buffer, IterVar, PrimExpr, Var
  from ...ir_builder import ir
  from ...ir_builder import tir
  from ...ir_builder.base import IRBuilder
  from ...ir_builder.base import IRBuilderFrame
  from .._core import Parser, dispatch, doc
label_desc: Use image node_id 11 for calling a global function with example usage: visit_function_def(node) without return types