def select(self, tag=None):
        """
            Select an item. If given a tag, this selects the first matching
            descendant (depth-first search), otherwise selects this item.

            Propagates the selection up the path to the root item (including
            the root item)

            @param tag: a string
        """

        selected = None
        if tag is None:
            parent = self.parent
            if parent:
                parent.select()
            else:
                self.deselect_all()
            selected = True
        else:
            for item in self.components:
                if not selected:
                    selected = item.select(tag=tag)
                else:
                    item.deselect_all()
            if not selected and tag in self.tags:
                selected = True
        self.selected = selected
        return selected

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3/s3navigation.py/S3NavigationItem.select/original