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.
  
      criteria : callable, optional
  
      Yields
      ------
      doctest.DocTest
          The next doctest found in the object.
      """
      for name, member in inspect.getmembers(obj):
          if criteria is not None and not criteria(name):
              continue
  
          if inspect.ismodule(member):
              if _file_from_library(
                  member, obj_name
              ) and _is_python_module(member):
                  _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 member.__module__ and _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 pylibcugraph
  import cudf
  from numba import cuda
  from cugraph.testing import utils
label_desc: Use image node_id 6 for calling a global function with example usage: _find_doctests_in_obj(finder, obj, obj_name, criteria) without return types