code: def create_legend(position, title):
      if position == "none":
          legend = None
      else:
          position = {"orient": position} if position else {}
          legend = {"title": title, **position}
  
      return legend
  
imports: from __future__ import annotations
  import json
  from types import ModuleType
  from typing import Any, Callable, Literal
  import altair
  import pandas
  from gradio_client.documentation import document, set_documentation_group
  from gradio import processing_utils
  from gradio.components.base import Component
  from gradio.data_classes import GradioModel
  from gradio.events import Events
label_desc: Use image node_id 1 for calling the AltairPlot obj's underlying member method code with example usage: obj.create_legend(position, title) and returns: legend