<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def originate(self, data='', syn=False, ack=False, fin=False, rst=False):
 """ Create a packet, enqueue it to be sent, and return it. """

        if self._ackTimer is not None:
            self._ackTimer.cancel()
            self._ackTimer = None
        if syn:
            # We really should be randomizing the ISN but until we finish the
            # implementations of the various bits of wraparound logic that were
            # started with relativeSequence
            assert self.nextSendSeqNum == 0, (
                "NSSN = " + repr(self.nextSendSeqNum))
            assert self.hostSendISN == 0
        p = PTCPPacket.create(self.hostPseudoPort,
                              self.peerPseudoPort,
                              seqNum=(self.nextSendSeqNum +
                                      self.hostSendISN) % (2**32),
                              ackNum=self.currentAckNum(),
                              data=data,
                              window=self.recvWindow,
                              syn=syn, ack=ack, fin=fin, rst=rst,
                              destination=self.peerAddressTuple)
        # do we want to enqueue this packet for retransmission?
        sl = p.segmentLength()
        self.nextSendSeqNum += sl

        if p.mustRetransmit():
            # print self, 'originating retransmittable packet', len(self.retransmissionQueue)
            if self.retransmissionQueue:
                if self.retransmissionQueue[-1].fin:
                    raise AssertionError("Sending %r after FIN??!" % (p,))
            # print 'putting it on the queue'
            self.retransmissionQueue.append(p)
            # print 'and sending it later'
            self._retransmitLater()
            if not self.sendWindowRemaining: # len(self.retransmissionQueue) > 5:
                # print 'oh no my queue is too big'
                # This is a random number (5) because I ought to be summing the
                # packet lengths or something.
                self._writeBufferFull()
            else:
                # print 'my queue is still small enough', len(self.retransmissionQueue), self, self.sendWindowRemaining
                pass
        self.ptcp.sendPacket(p)
        return p