def search_namespace(namespace, string, depth=3):
    """ Iterator on a dictionnary-like object.

        Given a namespace, search recursively for a name containing the
        string in the enclosed modules and classes.
    """
    if depth==0:
        raise StopIteration
    for child_name in namespace:
        child = namespace[child_name]
        if string in child_name:
            yield child_name, child
        if hasattr(child, '__dict__'):
            for suitable_child_name, suitable_child in \
                    search_namespace(child.__dict__,
                                                string, depth=depth-1):
                yield ((child_name, suitable_child_name) % '%s.%s',
                                    suitable_child)
dataset/ETHPy150Open enthought/envisage/envisage/plugins/ipython_shell/view/namespace_view.py/search_namespace/swapped operands of `%`