@internationalizeDocstring
    def todo(self, irc, msg, args, user, taskid):
        """[<username>] [<task id>]

        Retrieves a task for the given task id.  If no task id is given, it
        will return a list of task ids that that user has added to their todo
        list.
        """
        try:
            u = ircdb.users.getUser(msg.prefix)
        except __HOLE__:
            u = None
        if u != user and not self.registryValue('allowThirdpartyReader'):
            irc.error(_('You are not allowed to see other users todo-list.'))
            return
        # List the active tasks for the given user
        if not taskid:
            try:
                tasks = self.db.getTodos(user.id)
                utils.sortBy(operator.attrgetter('priority'), tasks)
                tasks = [format(_('#%i: %s'), t.id, self._shrink(t.task))
                         for t in tasks]
                Todo = 'Todo'
                if len(tasks) != 1:
                    Todo = 'Todos'
                irc.reply(format(_('%s for %s: %L'),
                                 Todo, user.name, tasks))
            except dbi.NoRecordError:
                if u != user:
                    irc.reply(_('That user has no tasks in their todo list.'))
                else:
                    irc.reply(_('You have no tasks in your todo list.'))
                return
        # Reply with the user's task
        else:
            try:
                t = self.db.get(user.id, taskid)
                if t.active:
                    active = _('Active')
                else:
                    active = _('Inactive')
                if t.priority:
                    t.task += format(_(', priority: %i'), t.priority)
                at = time.strftime(conf.supybot.reply.format.time(),
                                   time.localtime(t.at))
                s = format(_('%s todo for %s: %s (Added at %s)'),
                           active, user.name, t.task, at)
                irc.reply(s)
            except dbi.NoRecordError:
                irc.errorInvalid(_('task id'), taskid)
dataset/ETHPy150Open ProgVal/Limnoria/plugins/Todo/plugin.py/Todo.todo