def receivedHeader(self, helo, origin, recipients):
        """
        Generate a received header string for a message.

        @type helo: 2-L{tuple} of (L{bytes}, L{bytes})
        @param helo: The client's identity as sent in the HELO command and its
            IP address.

        @type origin: L{Address}
        @param origin: The origination address of the message.

        @type recipients: L{list} of L{User}
        @param recipients: The destination addresses for the message.

        @rtype: L{bytes}
        @return: A received header string.
        """
        authStr = heloStr = b""
        if self.user:
            authStr = b" auth=" + self.user.encode('xtext')
        if helo[0]:
            heloStr = b" helo=" + helo[0]
        fromUser = (b"from " + helo[0] + b" ([" + helo[1] + b"]" +
                 heloStr + authStr)
        by = (b"by " + self.host + b" with " + self.protocolName +
              b" (" + longversion.encode("ascii") + b")")
        forUser = (b"for <" + b' '.join(map(bytes, recipients)) + b"> " +
                smtp.rfc822date())
        return (b"Received: " + fromUser + b"\n\t" + by +
                b"\n\t" + forUser)

        Generate a received header string for a message.

        @type helo: 2-L{tuple} of (L{bytes}, L{bytes})
        @param helo: The client's identity as sent in the HELO command and its
            IP address.

        @type origin: L{Address}
        @param origin: The origination address of the message.

        @type recipients: L{list} of L{User}
        @param recipients: The destination addresses for the message.

        @rtype: L{bytes}
        @return: A received header string.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/protocols.py