docs: def palette(fg, bg=-1):
      """
      Since curses only supports a finite amount of initialised colour pairs
      we memoise any selections you've made as an attribute on this function
      """
  
      if not hasattr(palette, "counter"):
          palette.counter = 1
  
      if not hasattr(palette, "selections"):
          palette.selections = {}
  
      selection = "%s%s" % (str(fg), str(bg))
      if not selection in palette.selections:
          palette.selections[selection] = palette.counter
          palette.counter += 1
  
      # Get available colours
      colors = [c for c in dir(_curses) if c.startswith('COLOR')]
      if isinstance(fg, str):
          if not "COLOR_"+fg.upper() in colors:
              fg = -1
          else:
              fg = getattr(_curses, "COLOR_"+fg.upper())
      if isinstance(bg, str):
          if not "COLOR_"+bg.upper() in colors:
              bg = -1
          else:
              bg = getattr(_curses, "COLOR_"+bg.upper())
  
      _curses.init_pair(palette.selections[selection], fg, bg)
      return _curses.color_pair(palette.selections[selection])