def hex(color: tuple, prefix: str='#') -> str:
    """
    Convert RGB to HEX.

    :param color: 3-element tuple with color RGB values
    :param prefix: string prefix
    :return: string with color in hex
    """
    if len(color) is not 3:
        raise ValueError('Color should be a 3 element tuple')
    if not all([0 <= v <= 255 for v in color]):
        raise ValueError('RGB values have to be in range from 0 to 255')
    return '{}{:02x}{:02x}{:02x}'.format(prefix, color[0], color[1], color[2])