Uses ``wraps`` to be able to pickle patched methods.