def move_with_backup(path, suffix='.bak'):
    """
    Ensures that a path is not occupied. If there is a file, rename it by
    adding @suffix. Resursively backs up everything.

    Args:
        path: file path to clear
        suffix: Add to backed up files (default: {'.bak'})
    """
    path = str(path)
    if os.path.exists(path):
        move_with_backup(path + suffix)
        shutil.move(path, path + suffix)

    Ensures that a path is not occupied. If there is a file, rename it by
    adding @suffix. Resursively backs up everything.

    Args:
        path: file path to clear
        suffix: Add to backed up files (default: {'.bak'})
    
surreal/utils/filesys.py