code: def mark_typed_object(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_obj(obj):
              if obj is None:
                  return None
              return obj.dump()
          def _restore_obj(obj):
              if obj is None:
                  return obj
              return type_object.Restore(obj)
          self.mark_complex(name, _dump_obj, _restore_obj)