code: def _get_axes(kwargs: Dict[str, Any], *, use_3d: bool = False, use_polar: bool = False) -> Tuple[Figure, Union[Axes, Axes3D]]:
      
      figsize = kwargs.pop("figsize", default_figsize)
      if "ax" in kwargs:
          ax = kwargs.pop("ax")
          fig = ax.get_figure()
      elif use_3d:
          fig = plt.figure(figsize=figsize)
          ax = fig.add_subplot(111, projection='3d')
      elif use_polar:
          fig = plt.figure(figsize=figsize)
          ax = fig.add_subplot(111, projection='polar')
      else:
          fig, ax = plt.subplots(figsize=figsize)
      return fig, ax
docs: Prepare the axis to draw into.
  
      Parameters
      ----------
      use_3d: If True, an axis with 3D projection is created.
      use_polar: If True, the plot will have polar coordinates.
  
      Kwargs
      ------
      ax: Optional[plt.Axes]
          An already existing axis to be used.
      figsize: Optional[tuple]
          Size of the new figure (if no axis is given).
  
      Returns
      ------
      fig : plt.Figure
      ax : plt.Axes | Axes3D