<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hex2rgb(str_rgb):
 """Transform hex RGB representation to RGB tuple :param str_rgb: 3 hex char or 6 hex char string representation :rtype: RGB 3-uple of float between 0 and 1 (0.0, 1.0, 0.0) (0.0, 1.0, 0.0) Traceback (most recent call last):
 ValueError: Invalid value '#aa' provided for rgb color. """


    try:
        rgb = str_rgb[1:]

        if len(rgb) == 6:
            r, g, b = rgb[0:2], rgb[2:4], rgb[4:6]
        elif len(rgb) == 3:
            r, g, b = rgb[0] * 2, rgb[1] * 2, rgb[2] * 2
        else:
            raise ValueError()
    except:
        raise ValueError("Invalid value %r provided for rgb color."
                         % str_rgb)

    return tuple([float(int(v, 16)) / 255 for v in (r, g, b)])