def __init__(self, errorCode, description, fatal=False, local=None):
        """Create a remote error with an error code and description.

        @param errorCode: the AMP error code of this error.
        @type errorCode: C{bytes}

        @param description: some text to show to the user.
        @type description: C{str}

        @param fatal: a boolean, true if this error should terminate the
        connection.

        @param local: a local Failure, if one exists.
        """
        if local:
            localwhat = ' (local)'
            othertb = local.getBriefTraceback()
        else:
            localwhat = ''
            othertb = ''

        # Backslash-escape errorCode. Python 3.5 can do this natively
        # ("backslashescape") but Python 2.7 and Python 3.4 can't.
        if _PY3:
            errorCodeForMessage = "".join(
                "\\x%2x" % (c,) if c >= 0x80 else chr(c)
                for c in errorCode)
        else:
            errorCodeForMessage = "".join(
                "\\x%2x" % (ord(c),) if ord(c) >= 0x80 else c
                for c in errorCode)

        if othertb:
            message = "Code<%s>%s: %s\n%s" % (
                errorCodeForMessage, localwhat, description, othertb)
        else:
            message = "Code<%s>%s: %s" % (
                errorCodeForMessage, localwhat, description)

        super(RemoteAmpError, self).__init__(message)
        self.local = local
        self.errorCode = errorCode
        self.description = description
        self.fatal = fatal
Create a remote error with an error code and description.

        @param errorCode: the AMP error code of this error.
        @type errorCode: C{bytes}

        @param description: some text to show to the user.
        @type description: C{str}

        @param fatal: a boolean, true if this error should terminate the
        connection.

        @param local: a local Failure, if one exists.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/amp.py