code: def acquire_try_once(self):
          
          
          if self.is_locked_by_me():
              return True
          else:
              try:
                  self.fd = os.open(self.lock_filename, os.O_CREAT | os.O_RDWR | os.O_EXCL)
              except FileExistsError:
                  logger.debug('I tried to get the lock {}, but another process was faster.'.format(self.lock_filename))
                  return False
              else:
                  os.write(self.fd, str(self.pid).encode('utf-8'))
                  logger.debug('I got the lock {}.'.format(self.lock_filename))
                  return True
docs: Try to aquire the lock once.