class_docstr: Distributed Centralized Lock
  
  Parameters
  ----------
  name: string (optional)
      Name of the lock to acquire.  Choosing the same name allows two
      disconnected processes to coordinate a lock.  If not given, a random
      name will be generated.
  client: Client (optional)
      Client to use for communication with the scheduler.  If not given, the
      default global client will be used.
  
  Examples
  --------
  >>> lock = Lock('x')  # doctest: +SKIP
  >>> lock.acquire(timeout=1)  # doctest: +SKIP
  >>> # do things with protected resource
  >>> lock.release()  # doctest: +SKIP
class_docstr_tok: ["Distributed","Centralized","Lock","Parameters","--","--","--","--","--","name",":","string","(","optional",")","Name","of","the","lock","to","acquire",".","Choosing","the","same","name","allows","two","disconnected","processes","to","coordinate","a","lock",".","If","not","given",",","a","random","name","will","be","generated",".","client",":","Client","(","optional",")","Client","to","use","for","communication","with","the","scheduler",".","If","not","given",",","the","default","global","client","will","be","used",".","Examples","--","--","--","--",">",">",">","lock","=","Lock","(","'","x","'",")","#","doctest",":","+SKIP",">",">",">","lock.acquire","(","timeout=1",")","#","doctest",":","+SKIP",">",">",">","#","do","things","with","protected","resource",">",">",">","lock.release","(",")","#","doctest",":","+SKIP"]
docstr: Release the lock if already acquired
docstr_tok: ["Release","the","lock","if","already","acquired"]
code: def release(self):
      """Release the lock if already acquired"""
      self._verify_running()
      if not self.locked():
          raise ValueError("Lock is not yet acquired")
      result = self.client.sync(
          self.client.scheduler.lock_release, name=self.name, id=self.id
      )
      self._locked = False
      return result
  
imports: from __future__ import annotations
  import asyncio
  import logging
  import uuid
  from collections import defaultdict, deque
  from dask.utils import parse_timedelta
  from distributed.utils import TimeoutError, log_errors, wait_for
  from distributed.worker import get_client
label_desc: Use image node_id 5 for calling the Lock obj's underlying member method code with example usage: obj.release() and returns: result