code: def hex2rgb(hexvalue):
      
  
      # Make sure a possible '#' char is eliminated
      # before processing the color.
      if ('#' in hexvalue):
          hexcolor = hexvalue.replace('#', '')
      else:
          hexcolor = hexvalue
  
      # Hex colors have a fixed length of 6 characters excluding the '#'
      # TODO: Include custom exception here, even if it should never happen.
      if (len(hexcolor) != 6):
          print ("Unexpected length of hex color value.\nSix characters excluding \'#\' expected.")
          return 0
  
      # Convert each two characters of
      # the hex to an RGB color value.
      r = int(hexcolor[0:2], HEX_BASE)
      g = int(hexcolor[2:4], HEX_BASE)
      b = int(hexcolor[4:6], HEX_BASE)
  
      return r, g, b
docs: Converts a given hex color to
      its respective rgb color.