docs: def parse(self, channel_id, payload):
          '''
          Parse a header frame for a channel given a Reader payload.
          '''
          class_id = payload.read_short()
          weight = payload.read_short()
          size = payload.read_longlong()
          properties = {}
  
          # The AMQP spec is overly-complex when it comes to handling header
          # frames. The spec says that in addition to the first 16bit field,
          # additional ones can follow which /may/ then be in the property list
          # (because bit flags aren't in the list). Properly implementing custom
          # values requires the ability change the properties and their types,
          # which someone is welcome to do, but seriously, what's the point?
          # Because the complexity of parsing and writing this frame directly
          # impacts the speed at which messages can be processed, there are two
          # branches for both a fast parse which assumes no changes to the
          # properties and a slow parse. For now it's up to someone using custom
          # headers to flip the flag.
          if self.DEFAULT_PROPERTIES:
              flag_bits = payload.read_short()
              for key, proptype, rfunc, wfunc, mask in self.PROPERTIES:
                  if flag_bits & mask:
                      properties[key] = rfunc(payload)
          else:
              flags = []
              while True:
                  flag_bits = payload.read_short()
                  flags.append(flag_bits)
                  if flag_bits & 1 == 0:
                      break
  
              shift = 0
              for key, proptype, rfunc, wfunc, mask in self.PROPERTIES:
                  if shift == 0:
                      if not flags:
                          break
                      flag_bits, flags = flags[0], flags[1:]
                      shift = 15
                  if flag_bits & (1 << shift):
                      properties[key] = rfunc(payload)
                  shift -= 1
  
          return HeaderFrame(channel_id, class_id, weight, size, properties)