def _unlock(self): if not fcntl or not self.ser: return fcntl.flock(self.ser.fileno(), fcntl.LOCK_UN) logging.debug('_unlock')