code: def acquire(self):
          
          # handle thread lock
          if Handler:
              # under some tests Handler ends up being null due to instantiation
              # order
              Handler.acquire(self)
  
          # Issue a file lock.  (This is inefficient for multiple active threads
          # within a single process. But if you're worried about high-performance,
          # you probably aren't using this log handler.)
          if self.stream_lock:
              # If stream_lock=None, then assume close() was called or something
              # else weird and ignore all file-level locks.
              if self.stream_lock.closed:
                  # Daemonization can close all open file descriptors, see
                  # https://bugzilla.redhat.com/show_bug.cgi?id=952929
                  # Try opening the lock file again.  Should we warn() here?!?
                  try:
                      self._open_lockfile()
                  except Exception:
                      self.handleError(NullLogRecord())
                      # Don't try to open the stream lock again
                      self.stream_lock = None
                      return
              lock(self.stream_lock, LOCK_EX)
docs: Acquire thread and file locks.  Re-opening log for 'degraded' mode.