code: def make_axes(
      parents,
      location=None,
      orientation=None,
      fraction=0.15,
      shrink=1.0,
      aspect=20,
      **kw,
  ):
      """
      Resize and reposition parent axes, and return a child
      axes suitable for a colorbar.
  
      Keyword arguments may include the following (with defaults):
  
          location : [None|'left'|'right'|'top'|'bottom']
              The position, relative to **parents**, where the colorbar axes
              should be created. If None, the value will either come from the
              given ``orientation``, else it will default to 'right'.
  
          orientation :  [None|'vertical'|'horizontal']
              The orientation of the colorbar. Typically, this keyword shouldn't
              be used, as it can be derived from the ``location`` keyword.
  
      %s
  
      Returns (cax, kw), the child axes and the reduced kw dictionary to be
      passed when creating the colorbar instance.
      """
      locations = ["left", "right", "top", "bottom"]
      if orientation is not None and location is not None:
          raise TypeError(
              "position and orientation are mutually exclusive. "
              "Consider setting the position to any of {}".format(
                  ", ".join(locations)
              )
          )
  
      # provide a default location
      if location is None and orientation is None:
          location = "right"
  
      # allow the user to not specify the location by specifying the
      # orientation instead
      if location is None:
          location = "right" if orientation == "vertical" else "bottom"
  
      if location not in locations:
          raise ValueError(
              "Invalid colorbar location. Must be one "
              "of %s" % ", ".join(locations)
          )
  
      default_location_settings = {
          "left": {
              "anchor": (1.0, 0.5),
              "panchor": (0.0, 0.5),
              "pad": 0.10,
              "orientation": "vertical",
          },
          "right": {
              "anchor": (0.0, 0.5),
              "panchor": (1.0, 0.5),
              "pad": 0.05,
              "orientation": "vertical",
          },
          "top": {
              "anchor": (0.5, 0.0),
              "panchor": (0.5, 1.0),
              "pad": 0.05,
              "orientation": "horizontal",
          },
          "bottom": {
              "anchor": (0.5, 1.0),
              "panchor": (0.5, 0.0),
              "pad": 0.15,  # backwards compat
              "orientation": "horizontal",
          },
      }
  
      loc_settings = default_location_settings[location]
  
      # put appropriate values into the kw dict for passing back to
      # the Colorbar class
      kw["orientation"] = loc_settings["orientation"]
      kw["ticklocation"] = location
  
      anchor = kw.pop("anchor", loc_settings["anchor"])
      parent_anchor = kw.pop("panchor", loc_settings["panchor"])
  
      parents_iterable = cbook.iterable(parents)
      # turn parents into a list if it is not already. We do this w/ np
      # because `plt.subplots` can return an ndarray and is natural to
      # pass to `colorbar`.
      parents = np.atleast_1d(parents).ravel()
  
      # check if using constrained_layout:
      try:
          gs = parents[0].get_subplotspec().get_gridspec()
          using_constrained_layout = gs._layoutbox is not None
      except AttributeError:
          using_constrained_layout = False
  
      # defaults are not appropriate for constrained_layout:
      pad0 = loc_settings["pad"]
      if using_constrained_layout:
          pad0 = 0.02
      pad = kw.pop("pad", pad0)
  
      fig = parents[0].get_figure()
      if not all(fig is ax.get_figure() for ax in parents):
          raise ValueError(
              "Unable to create a colorbar axes as not all "
              "parents share the same figure."
          )
  
      # take a bounding box around all of the given axes
      parents_bbox = mtransforms.Bbox.union(
          [ax.get_position(original=True).frozen() for ax in parents]
      )
  
      pb = parents_bbox
      if location in ("left", "right"):
          if location == "left":
              pbcb, _, pb1 = pb.splitx(fraction, fraction + pad)
          else:
              pb1, _, pbcb = pb.splitx(1 - fraction - pad, 1 - fraction)
          pbcb = pbcb.shrunk(1.0, shrink).anchored(anchor, pbcb)
      else:
          if location == "bottom":
              pbcb, _, pb1 = pb.splity(fraction, fraction + pad)
          else:
              pb1, _, pbcb = pb.splity(1 - fraction - pad, 1 - fraction)
          pbcb = pbcb.shrunk(shrink, 1.0).anchored(anchor, pbcb)
  
          # define the aspect ratio in terms of y's per x rather than x's per y
          aspect = 1.0 / aspect
  
      # define a transform which takes us from old axes coordinates to
      # new axes coordinates
      shrinking_trans = mtransforms.BboxTransform(parents_bbox, pb1)
  
      # transform each of the axes in parents using the new transform
      for ax in parents:
          new_posn = shrinking_trans.transform(ax.get_position())
          new_posn = mtransforms.Bbox(new_posn)
          ax._set_position(new_posn)
          if parent_anchor is not False:
              ax.set_anchor(parent_anchor)
  
      cax = fig.add_axes(pbcb)
  
      # OK, now make a layoutbox for the cb axis.  Later, we will use this
      # to make the colorbar fit nicely.
      if not using_constrained_layout:
          # no layout boxes:
          lb = None
          lbpos = None
          # and we need to set the aspect ratio by hand...
          cax.set_aspect(aspect, anchor=anchor, adjustable="box")
      else:
          if not parents_iterable:
              # this is a single axis...
              ax = parents[0]
              lb, lbpos = constrained_layout.layoutcolorbarsingle(
                  ax, cax, shrink, aspect, location, pad=pad
              )
          else:  # there is more than one parent, so lets use gridspec
              # the colorbar will be a sibling of this gridspec, so the
              # parent is the same parent as the gridspec.  Either the figure,
              # or a subplotspec.
  
              lb, lbpos = constrained_layout.layoutcolorbargridspec(
                  parents, cax, shrink, aspect, location, pad
              )
  
      cax._layoutbox = lb
      cax._poslayoutbox = lbpos
  
      return cax, kw
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  from six.moves import xrange, zip
  import warnings
  import numpy
  import matplotlib
  import matplotlib.artist
  import matplotlib.cbook
  import matplotlib.collections
  import matplotlib.colors
  import matplotlib.contour
  import matplotlib.cm
  import matplotlib.gridspec
  import matplotlib.patches
  import matplotlib.path
  import matplotlib.ticker
  import matplotlib.transforms
  import matplotlib._layoutbox
  import matplotlib._constrained_layout
  from matplotlib import docstring
label_desc: Use image node_id 2 for calling a global function with example usage: make_axes(parents, location, orientation, fraction, shrink, aspect) and returns: cax,  kw