'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.'

def __init__(self, errorCode, description, fatal=False, local=None):

    if local:
        localwhat = '    (local)'
        othertb = local.getBriefTraceback()
    else:
        localwhat = ''
        othertb = ''
    if _PY3:
        errorCodeForMessage = ''.join(((('\\x%2x' % (c,)) if (c >= 128) else chr(c)) for c in errorCode))
    else:
        errorCodeForMessage = ''.join(((('\\x%2x' % (ord(c),)) if (ord(c) >= 128) 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
