Write hierarchy for a GO Term record and all GO IDs down to the leaf level.

def prt_hier_rec(self, item_id, depth=1):
        """Write hierarchy for a GO Term record and all GO IDs down to the leaf level."""
        # Shortens hierarchy report by only printing the hierarchy
        # for the sub-set of user-specified GO terms which are connected.
        if self.include_only and item_id not in self.include_only:
            return

        obj = self.id2obj[item_id]
        # Optionally space the branches for readability
        if self.space_branches:
            if depth == 1 and obj.children:
                self.prt.write("\n")
        # Print marks if provided
        if self.item_marks:
            self.prt.write('{MARK} '.format(
                MARK=self.item_marks.get(item_id, self.mark_dflt)))

        no_repeat = self.concise_prt and item_id in self.items_printed
        # Print content
        dashes = self._str_dash(depth, no_repeat, obj)
        if self.do_prtfmt:
            self._prtfmt(item_id, dashes)
        else:
            self._prtstr(obj, dashes)
        self.items_printed.add(item_id)
        self.items_list.append(item_id)
        # Do not print hierarchy below this turn if it has already been printed
        if no_repeat:
            return
        depth += 1
        if self.max_indent is not None and depth > self.max_indent:
            return
        children = obj.children if self.sortby is None else sorted(obj.children, key=self.sortby)
        for child in children:
            self.prt_hier_rec(child.item_id, depth)