def ensure_deletable(path, consider_lock_dead_if_created_before):
if path.is_symlink():<EOL><INDENT>return False<EOL><DEDENT>lock = get_lock_path(path)<EOL>if not lock.exists():<EOL><INDENT>return True<EOL><DEDENT>try:<EOL><INDENT>lock_time = lock.stat().st_mtime<EOL><DEDENT>except Exception:<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>if lock_time < consider_lock_dead_if_created_before:<EOL><INDENT>lock.unlink()<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>
checks if a lock exists and breaks it if its considered dead