import time


def _with_patched_sleep(func, *args, **kwargs):
    """Patch the sleep function so that it does nothing"""
    _sleep = time.sleep
    time.sleep = lambda *args: None
    try:
        return func(*args, **kwargs)
    finally:
        time.sleep = _sleep