code: def string_to_rgb(string):
      
  
      # if a single character
      if len(string) == 1:
  
          # Convert from single character to full hex
          if string.lower() not in color_char_to_word:
              raise ValueError('Single character string must be one of the following:'
                               '\n%s' % str(color_char_to_word.keys()))
  
          colorhex = hexcolors[color_char_to_word[string.lower()]]
  
      # if a color name
      elif string.lower() in hexcolors:
          colorhex = hexcolors[string.lower()]
  
      # try to convert to hex
      else:
          try:
              return hex_to_rgb(string)
          except:
              raise ValueError('Invalid color string or hex string.')
  
      return hex_to_rgb(colorhex)
docs: Converts a literal color string (i.e. white) to a color rgb.  Also accepts
      hex strings or single characters from the following list.
  
          b: blue
          g: green
          r: red
          c: cyan
          m: magenta
          y: yellow
          k: black
          w: white