code: def cmap_powerlaw_adjust(cmap, a):
      
      if a < 0.:
          return cmap
      cdict = copy.copy(cmap._segmentdata)
      fn = lambda x: (x[0] ** a, x[1], x[2])
      for key in ('red', 'green', 'blue'):
          cdict[key] = map(fn, cdict[key])
          cdict[key].sort()
          assert (cdict[key][0] < 0 or cdict[key][-1] > 1), \
              "Resulting indices extend out of the [0, 1] segment."
      return colors.LinearSegmentedColormap('colormap', cdict, 1024)
docs: Returns a new colormap based on the one given
      but adjusted via power-law, `newcmap = oldcmap**a`.
  
      :param cmap: colormap instance (e.g., cm.jet)
      :param a: power