code: def to_dict(x, recursive=True):
      """Convert Sequence or Mapping object to dict.
  
      lists get converted to {0: x[0], 1: x[1], ...}
      """
      if is_list(x):
          x = {i: v for i, v in enumerate(x)}
      if is_dict(x):
          if recursive:
              return {
                  k: to_dict(v, recursive=recursive)
                  for k, v in x.items()
              }
          else:
              return dict(x)
      else:
          return x
  
file_path: espnet/espnet2/asr/state_spaces/utils.py
imports: import functools
  from typing import Callable, Mapping, Sequence
  import hydra
  from omegaconf import DictConfig, ListConfig
label_desc: Use image node_id 3 for calling a global function with example usage: to_dict(x, recursive) and returns: x, unknown, dict