code: def from_dict(cls, val):
          
          if isinstance(val, dict2):
              return val
  
          elif isinstance(val, dict):
              res = cls()
              for k, v in val.items():
                  res[k] = cls.from_dict(v)
              return res
  
          elif isinstance(val, list):
              res = []
              for item in val:
                  res.append(cls.from_dict(item))
              return res
          else:
              return val
docs: Creates dict2 object from dict object
  
          Args:
              val (:obj:`dict`): Value to create from
  
          Returns:
              Equivalent dict2 object.