*Add a project to this taskpaper object*

        **Key Arguments:**
            - ``title`` -- the title for the project.
            - ``tags`` -- tag string (*"@one @two(data)"*) or list of tags (*['one', 'two(data)']*)
            - ``oldContent`` -- the old content to be replaced in parent object (user sould not need to give this)
            - ``newContent`` -- the replacement text for the parent object  (user sould not need to give this)

        **Return:**
            - ``project`` -- the new taskpaper project object

        **Usage:**

            To add a sub-project to a taskpaper document or project use:

            .. code-block:: python

                newProject = doc.add_project(
                    title="this is a projects I added",
                    tags="@with @tags"
                )

def add_project(
            self,
            title,
            tags=None):
        """*Add a project to this taskpaper object*

        **Key Arguments:**
            - ``title`` -- the title for the project.
            - ``tags`` -- tag string (*"@one @two(data)"*) or list of tags (*['one', 'two(data)']*)
            - ``oldContent`` -- the old content to be replaced in parent object (user sould not need to give this)
            - ``newContent`` -- the replacement text for the parent object  (user sould not need to give this)

        **Return:**
            - ``project`` -- the new taskpaper project object

        **Usage:**

            To add a sub-project to a taskpaper document or project use:

            .. code-block:: python

                newProject = doc.add_project(
                    title="this is a projects I added",
                    tags="@with @tags"
                )
        """
        self.refresh
        project = title.strip()
        if ":" != project[-1]:
            project += ":"

        if tags:
            if isinstance(tags, list):
                if "@" not in tags[0]:
                    tagString = (" @").join(tags)
                    tagString = "@" + tagString
                else:
                    tagString = (" ").join(tags)
            else:
                tagString = tags

            tagString = tagString.strip()
            project += " " + tagString

        newProject = self._get_object(
            regex=re.compile(
                r'((?<=\n)|(?<=^))(?P<title>(?!\[Searches\]|- )\S.*?:(?!\S)) *(?P<tagString>( *?@[^(\s]+(\([^)]*\))?)+)?(?P<content>(\n(( |\t)+\S.*)|\n( |\t)*|\n)+)', re.UNICODE),
            objectType="project",
            content=project
        )

        # ADD DIRECTLY TO CONTENT IF THE PROJECT IS BEING ADDED SPECIFICALLY TO
        # THIS OBJECT
        oldContent = self.to_string(indentLevel=1)
        newContent = self.to_string(
            indentLevel=1, projects=self.projects + newProject)

        if self.parent:
            doc = self.parent._update_document_tree(
                oldContent=oldContent,
                newContent=newContent
            )

        self.content = self.content.replace(self.to_string(indentLevel=0, title=False), self.to_string(
            indentLevel=0, title=False, projects=self.projects + newProject))

        doc = self
        while doc.parent:
            doc = doc.parent
        doc.refresh

        if not self.parent:
            parent = self
        else:
            parent = doc.get_project(self.title)

        thisProject = parent.get_project(title)

        self.refresh
        return thisProject