code: def lock(self, source_node):
          
          if self.status != self.S_INIT:
              raise ValueError("Trying to lock a task with status %s" % self.status)
  
          self._status = self.S_LOCKED
          self.history.info("Locked by node %s", source_node)
docs: Lock the task, source is the :class:`Node` that applies the lock.