parameters: (path, timeout=None)
return_statement: return decor
docstring: Decorator which enables locks for decorated function.
  
      Arguments:
       - path: path for lockfile.
       - timeout (optional): Timeout for acquiring lock.
  
       Usage:
           @locked('/var/run/myname', timeout=0)
           def myname(...):
               ...
docstring_summary: Decorator which enables locks for decorated function.
docstring_tokens: Decorator which enables locks for decorated function .
function: def locked(path, timeout=None):
      """Decorator which enables locks for decorated function.
  
      Arguments:
       - path: path for lockfile.
       - timeout (optional): Timeout for acquiring lock.
  
       Usage:
           @locked('/var/run/myname', timeout=0)
           def myname(...):
               ...
      """
      def decor(func):
          @functools.wraps(func)
          def wrapper(*args, **kwargs):
              lock = FileLock(path, timeout=timeout)
              lock.acquire()
              try:
                  return func(*args, **kwargs)
              finally:
                  lock.release()
          return wrapper
      return decor
function_tokens: def locked ( path , timeout = None ) : def decor ( func ) : @ functools . wraps ( func ) def wrapper ( * args , * * kwargs ) : lock = FileLock ( path , timeout = timeout ) lock . acquire ( ) try : return func ( * args , * * kwargs ) finally : lock . release ( ) return wrapper return decor