def hex_to_string(x):
    """
    Convert a tag number to it's original hex string.

    E.g. if a tag has the hex number 0x0008, it becomes 8,
    and we then convert it back to 0x0008 (as a string).
    """
    x = str(hex(x))
    left = x[:2]
    right = x[2:]
    num_zeroes = 4 - len(right)
    return left + ("0" * num_zeroes) + right