def deserialize_object(self, attr, **kwargs):
        """Deserialize a generic object.
        This will be handled as a dictionary.

        :param dict attr: Dictionary to be deserialized.
        :rtype: dict
        :raises: TypeError if non-builtin datatype encountered.
        """
        if attr is None:
            return None
        if isinstance(attr, ET.Element):
            # Do no recurse on XML, just return the tree as-is
            return attr
        if isinstance(attr, basestring):
            return self.deserialize_basic(attr, 'str')
        obj_type = type(attr)
        if obj_type in self.basic_types:
            return self.deserialize_basic(attr, self.basic_types[obj_type])
        if obj_type is _long_type:
            return self.deserialize_long(attr)

        if obj_type == dict:
            deserialized = {}
            for key, value in attr.items():
                try:
                    deserialized[key] = self.deserialize_object(
                        value, **kwargs)
                except ValueError:
                    deserialized[key] = None
            return deserialized

        if obj_type == list:
            deserialized = []
            for obj in attr:
                try:
                    deserialized.append(self.deserialize_object(
                        obj, **kwargs))
                except ValueError:
                    pass
            return deserialized

        else:
            error = "Cannot deserialize generic object with type: "
            raise TypeError(error + str(obj_type))
def deserialize_object ( self , attr , ** kwargs ) : if attr is None : return None if isinstance ( attr , ET . Element ) : return attr if isinstance ( attr , basestring ) : return self . deserialize_basic ( attr , 'str' ) obj_type = type ( attr ) if obj_type in self . basic_types : return self . deserialize_basic ( attr , self . basic_types [ obj_type ] ) if obj_type is _long_type : return self . deserialize_long ( attr ) if obj_type == dict : deserialized = { } for key , value in attr . items ( ) : try : deserialized [ key ] = self . deserialize_object ( value , ** kwargs ) except ValueError : deserialized [ key ] = None return deserialized if obj_type == list : deserialized = [ ] for obj in attr : try : deserialized . append ( self . deserialize_object ( obj , ** kwargs ) ) except ValueError : pass return deserialized else : error = "Cannot deserialize generic object with type: " raise TypeError ( error + str ( obj_type ) )
Deserialize a generic object.
        This will be handled as a dictionary.

        :param dict attr: Dictionary to be deserialized.
        :rtype: dict
        :raises: TypeError if non-builtin datatype encountered.