code: def get_seaborn_colorbar(dfr, classes):
      
      levels = sorted(list(set(classes.values())))
      paldict = {
          lvl: pal
          for (lvl, pal) in zip(
              levels,
              sns.cubehelix_palette(
                  len(levels), light=0.9, dark=0.1, reverse=True, start=1, rot=-2
              ),
          )
      }
      lvl_pal = {cls: paldict[lvl] for (cls, lvl) in list(classes.items())}
      col_cb = pd.Series(dfr.index).map(lvl_pal)
      # The col_cb Series index now has to match the dfr.index, but
      # we don't create the Series with this (and if we try, it
      # fails) - so change it with this line
      col_cb.index = dfr.index
      return col_cb
docs: Return a colorbar representing classes, for a Seaborn plot.
  
      The aim is to get a pd.Series for the passed dataframe columns,
      in the form:
      0    colour for class in col 0
      1    colour for class in col 1
      ...  colour for class in col ...
      n    colour for class in col n