Register a task in this legion.  "periodic" should be None, or
        a callback function which will be called periodically when the
        legion is otherwise idle.

def task_add(self, t, periodic=None):
        """
        Register a task in this legion.  "periodic" should be None, or
        a callback function which will be called periodically when the
        legion is otherwise idle.
    """
        name = t.get_name()
        if name in self._tasknames:
            raise TaskError(name, 'Task already exists with %d daemon%s active' %
                            (len(self._tasknames), ses(len(self._tasknames))))
        self._tasknames[name] = (t, periodic)
        self._tasks.add(t)