def short_hex(x):
    """Return shorthand hexadecimal code, ex: cc3300 -> c30"""
    t = list(x)
    if t[0] == t[1] and t[2] == t[3] and t[4] == t[5]:
        return '%s%s%s' % (t[0], t[2], t[4])
    else:
        return x