code: def collect_imports(imports: Set[Any], type_: Any) -> None:
      if is_list_annotation(type_):
          collect_imports(imports, get_list_element_type(type_))
          type_ = List
      elif is_dict_annotation(type_):
          kvt = get_dict_key_value_types(type_)
          collect_imports(imports, kvt[0])
          collect_imports(imports, kvt[1])
          type_ = Dict
      else:
          is_optional = _resolve_optional(type_)[0]
          if is_optional and type_ is not Any:
              type_ = Optional
      imports.add(type_)
  
file_path: hydra/tools/configen/configen/utils.py
imports: import sys
  from enum import Enum
  from typing import Any, Dict, Iterable, List, Optional, Set
  from omegaconf._utils import _resolve_optional, get_dict_key_value_types, get_list_element_type, is_dict_annotation, is_list_annotation, is_primitive_type_annotation
label_desc: Use image node_id 4 for calling a global function with example usage: collect_imports(imports, type_) without return types