code: def _dump_header(class_, method, tag, contents):
      
  
      header = b''
  
      id_num = 0
      id_num |= class_ << 6
      id_num |= method << 5
  
      if tag >= 31:
          header += chr_cls(id_num | 31)
          while tag > 0:
              continuation_bit = 0x80 if tag > 0x7F else 0
              header += chr_cls(continuation_bit | (tag & 0x7F))
              tag = tag >> 7
      else:
          header += chr_cls(id_num | tag)
  
      length = len(contents)
      if length <= 127:
          header += chr_cls(length)
      else:
          length_bytes = int_to_bytes(length)
          header += chr_cls(0x80 | len(length_bytes))
          header += length_bytes
  
      return header
docs: Constructs the header bytes for an ASN.1 object
  
      :param class_:
          An integer ASN.1 class value: 0 (universal), 1 (application),
          2 (context), 3 (private)
  
      :param method:
          An integer ASN.1 method value: 0 (primitive), 1 (constructed)
  
      :param tag:
          An integer ASN.1 tag value
  
      :param contents:
          A byte string of the encoded byte contents
  
      :return:
          A byte string of the ASN.1 DER header