docs: def get_module_attr(module_filename, module_attr, namespace=None):
      """Get an attribute from a module.
  
      This uses exec to load the module with a private namespace, and then
      plucks and returns the given attribute from that module's namespace.
  
      Note that, while this method doesn't have any explicit unit tests, it is
      tested implicitly by the doctor's own documentation. The Sphinx
      build process will fail to generate docs if this does not work.
  
      :param str module_filename: Path to the module to execute (e.g.
          "../src/app.py").
      :param str module_attr: Attribute to pluck from the module's namespace.
          (e.g. "app").
      :param dict namespace: Optional namespace. If one is not passed, an empty
          dict will be used instead. Note that this function mutates the passed
          namespace, so you can inspect a passed dict after calling this method
          to see how the module changed it.
      :returns: The attribute from the module.
      :raises KeyError: if the module doesn't have the given attribute.
      """
      if namespace is None:
          namespace = {}
      module_filename = os.path.abspath(module_filename)
      namespace['__file__'] = module_filename
      module_dir = os.path.dirname(module_filename)
      old_cwd = os.getcwd()
      old_sys_path = sys.path[:]
      try:
          os.chdir(module_dir)
          sys.path.append(module_dir)
          with open(module_filename, 'r') as mf:
              exec(compile(mf.read(), module_filename, 'exec'), namespace)
          return namespace[module_attr]
      finally:
          os.chdir(old_cwd)
          sys.path = old_sys_path