def METHOD_NAME(file_name):
    """Method to lock the file to avoid race condition"""
    lock_file = file_name + ".lock"
    exit_status = os.system(f"ls -l {lock_file}")
    if exit_status:
        print("File lock does not exist, Creating it")
        os.system(f"touch {lock_file}")
        return
    # If any process locks the file it will wait till it unlock
    timeout = 600
    timeout_start = time.time()
    while time.time() < timeout_start + timeout:
        # wait for 2 minutes before retrying
        time.sleep(120)
        exit_status = os.system(f"ls -l {lock_file}")
        if exit_status:
            print("File lock does not exist, Creating it")
            os.system(f"touch {lock_file}")
            return
    raise Exception(f"Lock file: {lock_file} already exist, can not create lock file")