code: def _find_doctests_in_obj(finder, obj, obj_name, criteria=None):
      """Find all doctests in a module or class.
      Parameters
      ----------
      finder : doctest.DocTestFinder
          The DocTestFinder object to use.
  
      obj : module or class
          The object to search for docstring examples.
  
      obj_name : string
          Used for ensuring a module is part of the object.
          To be passed into _module_from_library.
  
      criteria : callable, optional
  
      Yields
      ------
      doctest.DocTest
          The next doctest found in the object.
      """
      for name, member in inspect.getmembers(obj, inspect.isfunction):
          if criteria is not None and not criteria(name):
              continue
          if inspect.ismodule(member):
              yield from _find_doctests_in_obj(
                  finder, member, obj_name, criteria
              )
          if inspect.isfunction(member):
              yield from _find_doctests_in_docstring(finder, member)
          if inspect.isclass(member):
              if _module_from_library(member, obj_name):
                  yield from _find_doctests_in_docstring(finder, member)
  
imports: import contextlib
  import doctest
  import inspect
  import io
  import os
  import numpy
  import pandas
  import scipy
  import pytest
  import cugraph
  import cudf
  from cugraph.testing import utils
label_desc: Use image node_id 5 for calling a global function with example usage: _find_doctests_in_obj(finder, obj, obj_name, criteria) without return types