code: def itertype(x, default=tuple):
      """get the 'underlying' type used to construct x"""
      _type = type(x)
      try:
          if _type((0,)):
              return _type  # non-iterator iterables
      except TypeError:
          pass
      try:
          if _type(1):
              return _type  # non-iterables
      except TypeError:
          pass
      # iterators, etc
      _type = type(x).__name__.split("iterator")[0]
      types = ("xrange", "generator", "")  # and ...?
      if _type in types:
          return default
      try:
          return eval(_type)
      except NameError:
          return default
  
imports: from functools import reduce
  from collections.abc import Callable
  from mystic._counter import Counter
  from itertools import permutations
  from dill.source import getblocks
  from dill.source import getsource
  from mystic.monitors import Monitor
  from mystic.monitors import VerboseMonitor
  from mystic.monitors import LoggingMonitor
  from mystic.monitors import CustomMonitor
  from mystic.monitors import Null
label_desc: Use image node_id 2 for calling a global function with example usage: itertype(x, default) and returns: default, eval, _type, _type, default