code: def gen_dict_extract(
      key: str, obj: Dict
  ) -> Generator[Any, None, None]:
      if hasattr(obj, "items"):
          for k, v in obj.items():
              if k == key:
                  yield v
              if isinstance(v, dict):
                  for result in gen_dict_extract(key, v):
                      yield result
              elif isinstance(v, list):
                  for d in v:
                      for result in gen_dict_extract(key, d):
                          yield result
  
file_path: fklearn/src/fklearn/tuning/utils.py
imports: from typing import Any, Dict, Generator, List
  from toolz.curried import reduce, partial, pipe, first, curry
  from fklearn.metrics.pd_extractors import extract
  from fklearn.types import LogListType, LogType, ExtractorFnType, ValidatorReturnType, EvalReturnType
label_desc: Use image node_id 8 for calling a global function with example usage: gen_dict_extract(key, obj) without return types