code: def vals2colors(vals, cmap="GnBu", res=100):
      """Maps values to colors
      Args:
      values (list or list of lists) - list of values to map to colors
      cmap (str) - color map (default is 'GnBu')
      res (int) - resolution of the color map (default: 100)
      Returns:
      list of rgb tuples
      """
      # flatten if list of lists
      if any(isinstance(el, list) for el in vals):
          vals = list(itertools.chain(*vals))
  
      # get palette from seaborn
      palette = np.array(sns.color_palette(cmap, res))
      ranks = (
          np.digitize(
              vals, np.linspace(np.min(vals), np.max(vals) + 1, res + 1)
          )
          - 1
      )
      return [tuple(i) for i in palette[ranks, :]]
  
imports: import functools
  import sys
  import numpy
  import copy
  from scipy.interpolate import PchipInterpolator
  import seaborn
  import itertools
  import pandas
  from matplotlib.lines import Line2D
label_desc: Use image node_id 4 for calling a global function with example usage: vals2colors(vals, cmap, res) and returns: unknown