def is_legal_sequence(self, packet: DataPacket) -> bool:
        """
        Check if the Sequence number of the DataPacket is legal.
        For more information see page 17 of http://tsp.esta.org/tsp/documents/docs/E1-31-2016.pdf.
        :param packet: the packet to check
        :return: true if the sequence is legal. False if the sequence number is bad
        """
        # if the sequence of the packet is smaller than the last received sequence, return false
        # therefore calculate the difference between the two values:
        try:  # try, because self.lastSequence might not been initialized
            diff = packet.sequence - self.lastSequence[packet.universe]
            # if diff is between ]-20,0], return False for a bad packet sequence
            if 0 >= diff > -20:
                return False
        except:
            pass
        # if the sequence is good, return True and refresh the list with the new value
        self.lastSequence[packet.universe] = packet.sequence
        return True
def is_legal_sequence ( self , packet : DataPacket ) -> bool : try : diff = packet . sequence - self . lastSequence [ packet . universe ] if 0 >= diff > - 20 : return False except : pass self . lastSequence [ packet . universe ] = packet . sequence return True
Check if the Sequence number of the DataPacket is legal.
        For more information see page 17 of http://tsp.esta.org/tsp/documents/docs/E1-31-2016.pdf.
        :param packet: the packet to check
        :return: true if the sequence is legal. False if the sequence number is bad