def test_TSIG(self):
        """
        The byte stream written by L{dns.Record_TSIG.encode} can be used by
        L{dns.Record_TSIG.decode} to reconstruct the state of the original
        L{dns.Record_TSIG} instance.
        """
        mac = (b'\x00\x01\x02\x03\x10\x11\x12\x13'
               b'\x20\x21\x22\x23\x30\x31\x32\x33')
        rr = dns.Record_TSIG(algorithm='hmac-md5.sig-alg.reg.int',
                             timeSigned=1515548975,
                             originalID=42, fudge=5,
                             MAC=mac)
        self._recordRoundtripTest(rr)
        rdata = (b'\x08hmac-md5\x07sig-alg\x03reg\x03int\x00'
                 b'\x00\x00\x5a\x55\x71\x2f\x00\x05\x00\x10' +
                 mac + b'\x00\x2A\x00\x00\x00\x00')
        self.assertEncodedFormat(rdata, rr)

        rr = dns.Record_TSIG(algorithm='hmac-sha256',
                             timeSigned=4511798055,  # More than 32 bits
                             originalID=65535,
                             error=dns.EBADTIME,
                             otherData=b'\x80\x00\x00\x00\x00\x08',
                             MAC=mac)
        self._recordRoundtripTest(rr)
        rdata = (b'\x0Bhmac-sha256\x00'
                 b'\x00\x01\x0c\xec\x93\x27\x00\x05\x00\x10' +
                 mac + b'\xff\xff\x00\x12\x00\x06'
                 b'\x80\x00\x00\x00\x00\x08')
        self.assertEncodedFormat(rdata, rr)

        The byte stream written by L{dns.Record_TSIG.encode} can be used by
        L{dns.Record_TSIG.decode} to reconstruct the state of the original
        L{dns.Record_TSIG} instance.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/names/test/test_dns.py