docs: def dict2obj(d):
      """Convert a dict to an object or namespace
  
  
      >>> d = {'a': 1, 'b': {'c': 2}, 'd': ["hi", {'foo': "bar"}]}
      >>> obj = dict2obj(d)
      >>> obj.b.c
      2
      >>> obj.d
      ['hi', {'foo': 'bar'}]
      >>> d = {'a': 1, 'b': {'c': 2}, 'd': [("hi", {'foo': "bar"})]}
      >>> obj = dict2obj(d)
      >>> obj.d.hi.foo
      'bar'
      """
      if isinstance(d, (Mapping, list, tuple)):
          try:
              d = dict(d)
          except (ValueError, TypeError):
              return d
      else:
          return d
      obj = Object()
      for k, v in viewitems(d):
          obj.__dict__[k] = dict2obj(v)
      return obj