def change_endianness(x):
    """ Changes the endianness (from BE to LE and vice versa) of a given value.

    :param x: Given value which endianness will be changed.
    :type x: hex str
    :return: The opposite endianness representation of the given value.
    :rtype: hex str
    """
    if len(x) % 2 == 1:
        x += '0'
    y = x.decode('hex')
    z = y[::-1]
    return z.encode('hex')
