human
Complete this python program:
def fake_paths(check):
assistant
#Here is the Python program you requested.

    """Usage:
    >>> with fake_paths(lambda path: True if path.endswith(\.pdf\) else None):
    ...     assert os.path.exists(\my.pdf\)
    ...     assert os.path.exists(\Nopdf.txt\)
    The first assertion will be ok, the second assertion is not faked as the
    ``check`` returned ``None`` for this path.
    """
    original_exists = os.path.exists
    def patched_exists(path):
        result = check(path)
        if (result is None):
            return original_exists(path)
        return result
    return mock.patch.object(os.path, 'exists', patched_exists)