human
Solve the following python programming problem given the following code:
@pytest.fixture(scope='function')
def back_up_rc(request, user_config_path):
assistant
#Here is the Python program you requested.

    """Back up an existing cookiecutter rc and restore it after the test.
    If ~/.cookiecutterrc is pre-existing, move it to a temp location
    """
    user_config_path_backup = os.path.expanduser('~/.cookiecutterrc.backup')
    if os.path.exists(user_config_path):
        shutil.copy(user_config_path, user_config_path_backup)
        os.remove(user_config_path)
    def remove_test_rc():
        '\n                                Remove    the    ~/.cookiecutterrc    that    has    been    created    in    the    test.\n                                '
        if os.path.exists(user_config_path):
            os.remove(user_config_path)
    def restore_original_rc():
        '\n                                If    it    existed,    restore    the    original    ~/.cookiecutterrc\n                                '
        if os.path.exists(user_config_path_backup):
            shutil.copy(user_config_path_backup, user_config_path)
            os.remove(user_config_path_backup)
    request.addfinalizer(restore_original_rc)
    request.addfinalizer(remove_test_rc)