def mark_typed_map(self, name, type_object):
        """Mark a property as containing a map str to serializable object.

        This convenience method allows you to avoid having to call
        ``mark_complex()`` whenever you need to serialize a dict of objects.
        This method requires that all members of the given dict be of a single
        class that contains a dump() method and a Restore() class method where
        type_object.Restore(x.dump()) == x.

        Args:
            name (str): The name of the complex property.
            type_object: The class object that will be contained inside
                this dict.
        """

        if not hasattr(type_object, 'dump'):
            raise ArgumentError("The passed type object %s is missing required method: dump()" % type_object)
        if not hasattr(type_object, 'Restore'):
            raise ArgumentError("The passed type object %s is missing required method: Restore()" % type_object)

        def _dump_map(obj):
            if obj is None:
                return None

            if not isinstance(obj, dict):
                raise DataError("Property %s marked as list was not a dict: %s" % (name, repr(obj)))

            return {key: val.dump() for key, val in obj.items()}

        def _restore_map(obj):
            if obj is None:
                return obj

            return {key: type_object.Restore(val) for key, val in obj.items()}

        self.mark_complex(name, _dump_map, _restore_map)
def mark_typed_map ( self , name , type_object ) : if not hasattr ( type_object , 'dump' ) : raise ArgumentError ( "The passed type object %s is missing required method: dump()" % type_object ) if not hasattr ( type_object , 'Restore' ) : raise ArgumentError ( "The passed type object %s is missing required method: Restore()" % type_object ) def _dump_map ( obj ) : if obj is None : return None if not isinstance ( obj , dict ) : raise DataError ( "Property %s marked as list was not a dict: %s" % ( name , repr ( obj ) ) ) return { key : val . dump ( ) for key , val in obj . items ( ) } def _restore_map ( obj ) : if obj is None : return obj return { key : type_object . Restore ( val ) for key , val in obj . items ( ) } self . mark_complex ( name , _dump_map , _restore_map )
Mark a property as containing a map str to serializable object.

        This convenience method allows you to avoid having to call
        ``mark_complex()`` whenever you need to serialize a dict of objects.
        This method requires that all members of the given dict be of a single
        class that contains a dump() method and a Restore() class method where
        type_object.Restore(x.dump()) == x.

        Args:
            name (str): The name of the complex property.
            type_object: The class object that will be contained inside
                this dict.