Returns a color code number given the color name.

def nametonum(name):
    """
    Returns a color code number given the color name.
    """
    code = colorcodes.get(name)
    if code is None:
        raise ValueError("%s is not a valid color name." % name)
    else:
        return code