code: def inset_axes(
      parent_axes,
      width,
      height,
      loc=1,
      bbox_to_anchor=None,
      bbox_transform=None,
      axes_class=None,
      axes_kwargs=None,
      borderpad=0.5,
  ):
      """
      Create an inset axes with a given width and height.
  
      Both sizes used can be specified either in inches or percentage.
      For example,::
  
          inset_axes(parent_axes, width='40%%', height='30%%', loc=3)
  
      creates in inset axes in the lower left corner of *parent_axes* which spans
      over 30%% in height and 40%% in width of the *parent_axes*. Since the usage
      of `.inset_axes` may become slightly tricky when exceeding such standard
      cases, it is recommended to read
      :ref:`the examples <sphx_glr_gallery_axes_grid1_inset_locator_demo.py>`.
  
      Parameters
      ----------
      parent_axes : `matplotlib.axes.Axes`
          Axes to place the inset axes.
  
      width, height : float or str
          Size of the inset axes to create. If a float is provided, it is
          the size in inches, e.g. *width=1.3*. If a string is provided, it is
          the size in relative units, e.g. *width='40%%'*. By default, i.e. if
          neither *bbox_to_anchor* nor *bbox_transform* are specified, those
          are relative to the parent_axes. Otherwise they are to be understood
          relative to the bounding box provided via *bbox_to_anchor*.
  
      loc : int or string, optional, default to 1
          Location to place the inset axes. The valid locations are::
  
              'upper right'  : 1,
              'upper left'   : 2,
              'lower left'   : 3,
              'lower right'  : 4,
              'right'        : 5,
              'center left'  : 6,
              'center right' : 7,
              'lower center' : 8,
              'upper center' : 9,
              'center'       : 10
  
      bbox_to_anchor : tuple or `matplotlib.transforms.BboxBase`, optional
          Bbox that the inset axes will be anchored to. If None,
          *parent_axes.bbox* is used. If a tuple, can be either
          [left, bottom, width, height], or [left, bottom].
          If the kwargs *width* and/or *height* are specified in relative units,
          the 2-tuple [left, bottom] cannot be used. Note that
          the units of the bounding box are determined through the transform
          in use. When using *bbox_to_anchor* it almost always makes sense to
          also specify a *bbox_transform*. This might often be the axes transform
          *parent_axes.transAxes*.
  
      bbox_transform : `matplotlib.transforms.Transform`, optional
          Transformation for the bbox that contains the inset axes.
          If None, a `.transforms.IdentityTransform` is used (i.e. pixel
          coordinates). This is useful when not providing any argument to
          *bbox_to_anchor*. When using *bbox_to_anchor* it almost always makes
          sense to also specify a *bbox_transform*. This might often be the
          axes transform *parent_axes.transAxes*. Inversely, when specifying
          the axes- or figure-transform here, be aware that not specifying
          *bbox_to_anchor* will use *parent_axes.bbox*, the units of which are
          in display (pixel) coordinates.
  
      axes_class : `matplotlib.axes.Axes` type, optional
          If specified, the inset axes created will be created with this class's
          constructor.
  
      axes_kwargs : dict, optional
          Keyworded arguments to pass to the constructor of the inset axes.
          Valid arguments include:
          %(Axes)s
  
      borderpad : float, optional
          Padding between inset axes and the bbox_to_anchor. Defaults to 0.5.
          The units are axes font size, i.e. for a default font size of 10 points
          *borderpad = 0.5* is equivalent to a padding of 5 points.
  
      Returns
      -------
      inset_axes : `axes_class`
          Inset axes object created.
      """
  
      if axes_class is None:
          axes_class = HostAxes
  
      if axes_kwargs is None:
          inset_axes = axes_class(
              parent_axes.figure, parent_axes.get_position()
          )
      else:
          inset_axes = axes_class(
              parent_axes.figure,
              parent_axes.get_position(),
              **axes_kwargs,
          )
  
      if bbox_transform in [
          parent_axes.transAxes,
          parent_axes.figure.transFigure,
      ]:
          if bbox_to_anchor is None:
              warnings.warn(
                  "Using the axes or figure transform requires a "
                  "bounding box in the respective coordinates. "
                  "Using bbox_to_anchor=(0,0,1,1) now."
              )
              bbox_to_anchor = (0, 0, 1, 1)
  
      if bbox_to_anchor is None:
          bbox_to_anchor = parent_axes.bbox
  
      if isinstance(bbox_to_anchor, tuple) and (
          isinstance(width, str) or isinstance(height, str)
      ):
          if len(bbox_to_anchor) != 4:
              raise ValueError(
                  "Using relative units for width or height "
                  "requires to provide a 4-tuple or a "
                  "`BBox` instance to `bbox_to_anchor."
              )
  
      axes_locator = AnchoredSizeLocator(
          bbox_to_anchor,
          width,
          height,
          loc=loc,
          bbox_transform=bbox_transform,
          borderpad=borderpad,
      )
  
      inset_axes.set_axes_locator(axes_locator)
  
      _add_inset_axes(parent_axes, inset_axes)
  
      return inset_axes
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import warnings
  from matplotlib import docstring
  import six
  from matplotlib.offsetbox import AnchoredOffsetbox
  from matplotlib.patches import Patch, Rectangle
  from matplotlib.path import Path
  from matplotlib.transforms import Bbox, BboxTransformTo
  from matplotlib.transforms import IdentityTransform, TransformedBbox
  from .None import axes_size
  from .parasite_axes import HostAxes
label_desc: Use image node_id 2 for calling a global function with example usage: inset_axes(parent_axes, width, height, loc, bbox_to_anchor, bbox_transform, axes_class, axes_kwargs, borderpad) and returns: inset_axes