'Override the default deepcopy.
Keystone :class:`keystone.exception.Error` accepts an optional message
that will be used when rendering the exception object as a string. If
not provided the object\'s message_format attribute is used instead.
:class:`keystone.exception.SecurityError` is a little different in
that it only uses the message provided to the initializer when
keystone is in `insecure_debug` mode. Instead it will use its
`message_format`. This is to ensure that sensitive details are not
leaked back to the caller in a production deployment.
This dual mode for string rendering causes some odd behaviour when
combined with oslo_i18n translation. Any object used as a value for
formatting a translated string is deep copied.
The copy causes an issue. The deep copy process actually creates a new
exception instance with the rendered string. Then when that new
instance is rendered as a string to use for substitution a warning is
logged. This is because the code tries to use the `message_format` in
secure mode, but the required kwargs are not in the deep copy.
The end result is not an error because when the KeyError is caught the
instance\'s ``message`` is used instead and this has the properly
translated message. The only indication that something is wonky is a
message in the warning log.'

def __deepcopy__(self):

    return self
