code: def packet(self):
          
          if not self.finished:
              self.finished = 1
              for question in self.questions:
                  self.write_question(question)
              for answer, time in self.answers:
                  self.write_record(answer, time)
              for authority in self.authorities:
                  self.write_record(authority, 0)
              for additional in self.additionals:
                  self.write_record(additional, 0)
  
              self.insert_short(0, len(self.additionals))
              self.insert_short(0, len(self.authorities))
              self.insert_short(0, len(self.answers))
              self.insert_short(0, len(self.questions))
              self.insert_short(0, self.flags)
              if self.multicast:
                  self.insert_short(0, 0)
              else:
                  self.insert_short(0, self.id)
          return b''.join(self.data)
docs: Returns a string containing the packet's bytes
  
          No further parts should be added to the packet once this
          is done.