def get_deployment_lock(error_rerun_script):
    start_time = time.time()
    got_lock = False
    while time.time() - start_time < 300:
        try:
            os.mkdir(LOCK_DIR)
            got_lock = True
            break
        except __HOLE__:
            print(WARNING + "Another deployment in progress; waiting for lock... (If no deployment is running, rmdir %s)" % (LOCK_DIR,) + ENDC)
            sys.stdout.flush()
            time.sleep(3)

    if not got_lock:
        print(FAIL + "Deployment already in progress.  Please run\n"
              + "  %s\n" % (error_rerun_script,)
              + "manually when the previous deployment finishes, or run\n"
              + "  rmdir %s\n"  % (LOCK_DIR,)
              + "if the previous deployment crashed."
              + ENDC)
        sys.exit(1)
dataset/ETHPy150Open zulip/zulip/zulip_tools.py/get_deployment_lock