code: def _grab_overloads(fn):
      """grab @overload entries for a function, assuming black-formatted
      code ;) so that we can do a simple regex
  
      """
  
      # functions that use @util.deprecated and whatnot will have a string
      # generated fn.  we can look at __wrapped__ but these functions don't
      # have any overloads in any case right now so skip
      if fn.__code__.co_filename == "<string>":
          return []
  
      with open(fn.__code__.co_filename) as f:
          lines = [
              l for i, l in zip(range(fn.__code__.co_firstlineno), f)
          ]
  
          lines.reverse()
  
      output = []
  
      current_ov = []
      for line in lines[1:]:
          current_ov.append(line)
          outside_block_match = re.match(r"^\w", line)
          if outside_block_match:
              current_ov[:] = []
              break
  
          fn_match = re.match(
              r"^    (?:    )?(?:async )?def (.*)\(", line
          )
          if fn_match and fn_match.group(1) != fn.__name__:
              current_ov[:] = []
              break
  
          ov_match = re.match(r"^    (?:    )?@overload$", line)
          if ov_match:
              output.append("".join(reversed(current_ov)))
              current_ov[:] = []
  
          if re.match(r"^    if (?:typing\.)?TYPE_CHECKING:", line):
              output.append(line)
              current_ov[:] = []
  
      output.reverse()
      return output
  
imports: from __future__ import annotations
  import collections
  import importlib
  import inspect
  import os
  from pathlib import Path
  import re
  import sys
  from tempfile import NamedTemporaryFile
  import textwrap
  from typing import Any
  from typing import Callable
  from typing import Dict
  from typing import Iterable
  from typing import TextIO
  from typing import Tuple
  from typing import Type
  from typing import TypeVar
  from sqlalchemy import util
  from sqlalchemy.util import compat
  from sqlalchemy.util import langhelpers
  from sqlalchemy.util.langhelpers import format_argspec_plus
  from sqlalchemy.util.langhelpers import inject_docstring_text
  from sqlalchemy.util.tool_support import code_writer_cmd
label_desc: Use image node_id 2 for calling a global function with example usage: _grab_overloads(fn) and returns: output, list