code: def _hash(value, allow_id):
      try:
          hash(value)
          return value
      except TypeError as e:
          if isinstance(value, list):
              return tuple(_hash(x, allow_id) for x in value)
          elif isinstance(value, dict):
              return tuple(
                  sorted(
                      (_hash(x, allow_id), _hash(y, allow_id))
                      for x, y in value.items()
                  )
              )
          elif isinstance(value, set):
              return frozenset(_hash(x, allow_id) for x in value)
          elif isinstance(value, argparse.Namespace):
              return str(value)
          elif allow_id:
              return id(value)
          raise e
  
file_path: pyro/pyro/ops/jit.py
imports: import argparse
  import warnings
  import weakref
  import torch
  import pyro
  import pyro.poutine
  from pyro.util import ignore_jit_warnings, optional, timed
label_desc: Use image node_id 1 for calling a global function with example usage: _hash(value, allow_id) and returns: value, tuple, tuple, frozenset, str, id