def web2hex(web, force_long=False):
    if web.startswith('#'):
        if (LONG_HEX_COLOR.match(web) or
            (not force_long and SHORT_HEX_COLOR.match(web))):
            return web.lower()
        elif SHORT_HEX_COLOR.match(web) and force_long:
            return '#' + ''.join([("%s" % (t, )) * 2 for t in web[1:]])
        raise AttributeError(
            "%r is not in web format. Need 3 or 6 hex digit." % web)

    web = web.lower()
    if web not in COLOR_NAME_TO_RGB:
        raise ValueError("%r is not a recognized color." % web)

    ## convert dec to hex:

    return rgb2hex([float(int(v)) / 255 for v in COLOR_NAME_TO_RGB[web]], force_long)


## Missing functions convertion
Converts WEB representation to HEX
dataset/ETHPy150Open vaab/colour/colour.py/web2hex