def tlv_parse(data):
    """ Parses a bytestring of TLV values into a dict with the tags as keys."""
    parsed = {}
    while data:
        t, l, data = ord_byte(data[0]), ord_byte(data[1]), data[2:]
        parsed[t], data = data[:l], data[l:]
    return parsed
Parses a bytestring of TLV values into a dict with the tags as keys.