code: def draw_patch(data, obj):
      
      # Gather the draw options.
      data, draw_options = mypath.get_draw_options(
          data,
          obj,
          obj.get_edgecolor(),
          obj.get_facecolor(),
          obj.get_linestyle(),
          obj.get_linewidth(),
      )
  
      if isinstance(obj, mpl.patches.Rectangle):
          # rectangle specialization
          return _draw_rectangle(data, obj, draw_options)
      elif isinstance(obj, mpl.patches.Ellipse):
          # ellipse specialization
          return _draw_ellipse(data, obj, draw_options)
  
      # regular patch
      data, path_command, _, _ = mypath.draw_path(
          data, obj.get_path(), draw_options=draw_options
      )
      return data, path_command
docs: Return the PGFPlots code for patches.