code: def marshal(self, obj, as_map_key, cache):
          
          handler = self.handlers[obj]
          tag = handler.tag(obj)
          f = marshal_dispatch.get(tag)
  
          if f:
              f(self, obj, handler.string_rep(obj) if as_map_key else handler.rep(obj), as_map_key, cache)
          else:
              self.emit_encoded(tag, handler, obj, as_map_key, cache)
docs: Marshal an individual obj, potentially as part of another container
          object (like a list/dictionary/etc).  Specify if this object is a key
          to a map/dict, and pass in the current cache being used.
          This method should only be called by a top-level marshalling call
          and should not be considered an entry-point for integration.