docs: def encode_callbacks(callbacks):
      """Encode callbacks to as a dict suitable for JSON encoding."""
      from furious.async import Async
  
      if not callbacks:
          return
  
      encoded_callbacks = {}
      for event, callback in callbacks.iteritems():
          if callable(callback):
              callback, _ = get_function_path_and_options(callback)
  
          elif isinstance(callback, Async):
              callback = callback.to_dict()
  
          encoded_callbacks[event] = callback
  
      return encoded_callbacks