code: def format_norm(kwargs, current=None):
      
      norm = kwargs.pop('norm', current) or 'linear'
      vmin = kwargs.pop('vmin', None)
      vmax = kwargs.pop('vmax', None)
      clim = kwargs.pop('clim', (vmin, vmax)) or (None, None)
      clip = kwargs.pop('clip', None)
  
      if norm == 'linear':
          norm = colors.Normalize()
      elif norm == 'log':
          norm = colors.LogNorm()
      elif not isinstance(norm, colors.Normalize):
          raise ValueError("unrecognised value for norm {!r}".format(norm))
  
      for attr, value in (('vmin', clim[0]), ('vmax', clim[1]), ('clip', clip)):
          if value is not None:
              setattr(norm, attr, value)
  
      return norm, kwargs
docs: Format a `~matplotlib.colors.Normalize` from a set of kwargs
  
      Returns
      -------
      norm, kwargs
          the formatted `Normalize` instance, and the remaining keywords