def descendents(self, type=None):
    'Recursive, depth-first search; compliant with MItDag of 2017+\n\n            Example:\n                >>> grandparent = createNode("transform")\n                >>> parent = createNode("transform", parent=grandparent)\n                >>> child = createNode("transform", parent=parent)\n                >>> mesh = createNode("mesh", parent=child)\n                >>> it = grandparent.descendents(type=tMesh)\n                >>> next(it) == mesh\n                True\n                >>> next(it)\n                Traceback (most recent call last):\n                ...\n                StopIteration\n\n            '

    def _descendents(node, children=None):
        children = (children or list())
        children.append(node)
        for child in node.children(filter=None):
            _descendents(child, children)
        return children
    typeName = None
    if isinstance(type, str):
        typeName = type
        type = om.MFn.kInvalid
    descendents = _descendents(self)[1:]
    for child in descendents:
        if (typeName is None):
            if ((not type) or (type == child._fn.typeId)):
                (yield child)
        elif ((not typeName) or (typeName == child._fn.typeName)):
            (yield child)
Recursive, depth-first search; compliant with MItDag of 2017+

Example:
    >>> grandparent = createNode("transform")
    >>> parent = createNode("transform", parent=grandparent)
    >>> child = createNode("transform", parent=parent)
    >>> mesh = createNode("mesh", parent=child)
    >>> it = grandparent.descendents(type=tMesh)
    >>> next(it) == mesh
    True
    >>> next(it)
    Traceback (most recent call last):
    ...
    StopIteration
def descendents(self, type=None):
    'Recursive, depth-first search; compliant with MItDag of 2017+\n\n            Example:\n                >>> grandparent = createNode("transform")\n                >>> parent = createNode("transform", parent=grandparent)\n                >>> child = createNode("transform", parent=parent)\n                >>> mesh = createNode("mesh", parent=child)\n                >>> it = grandparent.descendents(type=tMesh)\n                >>> next(it) == mesh\n                True\n                >>> next(it)\n                Traceback (most recent call last):\n                ...\n                StopIteration\n\n            '

    def _descendents(node, children=None):
        children = (children or list())
        children.append(node)
        for child in node.children(filter=None):
            _descendents(child, children)
        return children
    typeName = None
    if isinstance(type, str):
        typeName = type
        type = om.MFn.kInvalid
    descendents = _descendents(self)[1:]
    for child in descendents:
        if (typeName is None):
            if ((not type) or (type == child._fn.typeId)):
                (yield child)
        elif ((not typeName) or (typeName == child._fn.typeName)):
            (yield child)