def expand_hex(x):
    """Expands shorthand hexadecimal code, ex: c30 -> cc3300"""
    if len(x) == 3:
        t = list(x)
        return "".join([t[0], t[0], t[1], t[1], t[2], t[2]])
    else:
        return x