code: def __deserialize(self, data, klass):
          
          if data is None:
              return None
  
          if type(klass) == str:
              if klass.startswith('list['):
                  sub_kls = re.match('list\[(.*)\]', klass).group(1)
                  return [self.__deserialize(sub_data, sub_kls)
                          for sub_data in data]
  
              if klass.startswith('dict('):
                  sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
                  return {k: self.__deserialize(v, sub_kls)
                          for k, v in iteritems(data)}
  
              # convert str to class
              # for native types
              if klass in ['int', 'float', 'str', 'bool',
                           "date", 'datetime', "object"]:
                  klass = eval(klass)
              # for model types
              else:
                  klass = eval('models.' + klass)
  
          if klass in [int, float, str, bool]:
              return self.__deserialize_primitive(data, klass)
          elif klass == object:
              return self.__deserialize_object(data)
          elif klass == date:
              return self.__deserialize_date(data)
          elif klass == datetime:
              return self.__deserialize_datatime(data)
          else:
              return self.__deserialize_model(data, klass)
docs: Deserializes dict, list, str into an object.
  
          :param data: dict, list or str.
          :param klass: class literal, or string of class name.
  
          :return: object.