code: def extract_handles(
      obj: Any,
      handles: List[Handle],
      visited: Optional[Set[int]] = None,
  ) -> None:
      """Extract the handles of `obj` to and add them into `handles`."""
      visited = visited or set()
      # Transitive input_handles from Deferred objects are included.
      if isinstance(obj, dereference.Deferred):
          if id(obj) not in visited:
              visited.add(id(obj))
              obj._apply_to_args(
                  functools.partial(
                      extract_handles, handles=handles, visited=visited
                  )
              )
      elif isinstance(obj, Handle):
          handles.append(obj)
  
imports: import abc
  import functools
  from typing import Any, Generic, List, Optional, Sequence, Set, TypeVar
  from launchpad import address
  from launchpad import context
  from launchpad.nodes import dereference
  from launchpad.program_stopper import program_stopper
label_desc: Use image node_id 1 for calling a global function with example usage: extract_handles(obj, handles, visited) without return types