def maybe_delete_a_numbered_dir(path):
lock_path = None<EOL>try:<EOL><INDENT>lock_path = create_cleanup_lock(path)<EOL>parent = path.parent<EOL>garbage = parent.joinpath("<STR_LIT>".format(uuid.uuid4()))<EOL>path.rename(garbage)<EOL>rmtree(garbage, force=True)<EOL><DEDENT>except (OSError, EnvironmentError):<EOL><INDENT>return<EOL><DEDENT>finally:<EOL><INDENT>if lock_path is not None:<EOL><INDENT>try:<EOL><INDENT>lock_path.unlink()<EOL><DEDENT>except (OSError, IOError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>
removes a numbered directory if its lock can be obtained and it does not seem to be in use