code: def tlv_parse(data):
      
      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
docs: Parses a bytestring of TLV values into a dict with the tags as keys.