Converts input to the hex string
    :param x:
    :return:

def to_hex(x):
    """
    Converts input to the hex string
    :param x:
    :return:
    """
    if isinstance(x, bytearray):
        x = bytes(x)
    elif isinstance(x, (list, tuple)):
        x = bytes(bytearray(x))
    if isinstance(x, basestring):
        return base64.b16encode(x).decode('ascii')
    else:
        raise ValueError('Unknown input argument type')