Decorator for function or method that do not modify the recorder state
    but have some side effects that can't be replayed.
    What it does in recording mode is keep the function name, arguments,
    keyword and result as a side effect that will be recorded in the journal.
    In replay mode, it will only pop the next expected side-effect, verify
    the function name, arguments and keywords and return the expected result
    without executing the real function code. If the function name, arguments
    or keywords were to be different than the expected ones, it would raise
    L{ReplayError}. Should work for any function or method.

def named_side_effect(original, name):
    """Decorator for function or method that do not modify the recorder state
    but have some side effects that can't be replayed.
    What it does in recording mode is keep the function name, arguments,
    keyword and result as a side effect that will be recorded in the journal.
    In replay mode, it will only pop the next expected side-effect, verify
    the function name, arguments and keywords and return the expected result
    without executing the real function code. If the function name, arguments
    or keywords were to be different than the expected ones, it would raise
    L{ReplayError}. Should work for any function or method."""

    def wrapper(callable, *args, **kwargs):
        return _side_effect_wrapper(callable, args, kwargs, name)

    return wrapper