'Find tests for the given object and any contained objects, and
add them to ``tests``.'

def _find(self, tests, obj, name, module, source_lines, globs, seen):

    if self._verbose:
        print(('Finding    tests    in    %s' % name))
    if (id(obj) in seen):
        return
    seen[id(obj)] = 1
    if inspect.isclass(obj):
        if (obj.__module__.split('.')[0] != 'sympy'):
            return
    test = self._get_test(obj, name, module, globs, source_lines)
    if (test is not None):
        tests.append(test)
    if (not self._recurse):
        return
    if inspect.ismodule(obj):
        for (rawname, val) in obj.__dict__.items():
            if (inspect.isfunction(val) or inspect.isclass(val)):
                if (val.__module__ != module.__name__):
                    continue
                assert self._from_module(module, val), ('%s    is    not    in    module    %s    (rawname    %s)' % (val, module, rawname))
                try:
                    valname = ('%s.%s' % (name, rawname))
                    self._find(tests, val, valname, module, source_lines, globs, seen)
                except KeyboardInterrupt:
                    raise
        for (valname, val) in getattr(obj, '__test__', {}).items():
            if (not isinstance(valname, string_types)):
                raise ValueError(('SymPyDocTestFinder.find:    __test__    keys    must    be    strings:    %r' % (type(valname),)))
            if (not (inspect.isfunction(val) or inspect.isclass(val) or inspect.ismethod(val) or inspect.ismodule(val) or isinstance(val, string_types))):
                raise ValueError(('SymPyDocTestFinder.find:    __test__    values    must    be    strings,    functions,    methods,    classes,    or    modules:    %r' % (type(val),)))
            valname = ('%s.__test__.%s' % (name, valname))
            self._find(tests, val, valname, module, source_lines, globs, seen)
    if inspect.isclass(obj):
        for (valname, val) in obj.__dict__.items():
            if isinstance(val, staticmethod):
                val = getattr(obj, valname)
            if isinstance(val, classmethod):
                val = getattr(obj, valname).__func__
            if (inspect.isfunction(val) or inspect.isclass(val) or isinstance(val, property)):
                if isinstance(val, property):
                    if hasattr(val.fget, '__module__'):
                        if (val.fget.__module__ != module.__name__):
                            continue
                elif (val.__module__ != module.__name__):
                    continue
                assert self._from_module(module, val), ('%s    is    not    in    module    %s    (valname    %s)' % (val, module, valname))
                valname = ('%s.%s' % (name, valname))
                self._find(tests, val, valname, module, source_lines, globs, seen)
