human
Complete the below
def fake_paths(check):

    ''''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.'
    '''
assistant
#Here is the Python code you requested.
    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)