import string


def makeValidMapKey(name):
    """Turns the given string into a valid key for use as a colour map
    or lookup table identifier.
    """

    valid = string.ascii_lowercase + string.digits + '_-'
    key   = name.lower().replace(' ', '_')
    key   = ''.join([c for c in key if c in valid])

    return key