def from_lane_to_hex_string(lane, w):
    """Convert a lane value to a string of bytes written in hexadecimal"""

    lane_hex_b_e = ((b"%%0%dX" % (w // 4)) % lane)
    # Perform the conversion
    temp = b''
    length = len(lane_hex_b_e) // 2
    for i in range(length):
        offset = (length - i - 1) * 2
        temp += lane_hex_b_e[offset:offset + 2]
    return temp.upper()