def tagged_tasks(<EOL>self,<EOL>tag):
self.refresh<EOL>tasksList = []<EOL>tag = tag.replace("<STR_LIT:@>", "<STR_LIT>").lower()<EOL>for t in self.tasks:<EOL><INDENT>for aTag in t.tags:<EOL><INDENT>if "<STR_LIT:(>" not in tag:<EOL><INDENT>aTag = aTag.split("<STR_LIT:(>")[<NUM_LIT:0>]<EOL><DEDENT>if aTag.lower() == tag:<EOL><INDENT>tasksList.append(t)<EOL>break<EOL><DEDENT><DEDENT>subtasks = t.tagged_tasks(tag)<EOL>tasksList += subtasks<EOL><DEDENT>isProject = False<EOL>try:<EOL><INDENT>this = self.projects<EOL>isProject = True<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>if isProject:<EOL><INDENT>for p in self.projects:<EOL><INDENT>subtasks = p.tagged_tasks(tag)<EOL>tasksList += subtasks<EOL><DEDENT><DEDENT>return tasksList<EOL>
*return a list of tasks contained within this taskpaper object filtered by a given tag*

        **Key Arguments:**
            - ``tag`` -- the tag to filter the tasks by.

        **Return:**
            - ``taskList`` -- the list of filtered tasks

        **Usage:**

            To filter the tasks recursively found with a taskpaper document object and return only those tasks tagged with ``flag``, using the following:

            .. code-block:: python

               filteredTasks = doc.tagged_tasks("@flag")
               for t in filteredTasks:
                    print t.title

            Note you can give the tag with or without the *@*, and you can also give a tag attribute, e.g. ``@due(today)``