code: def discover_plugins(dirs):
      
      # Scan all subdirectories recursively.
      for path in _iter_plugin_files(dirs):
          filename = op.basename(path)
          subdir = op.dirname(path)
          modname, ext = op.splitext(filename)
          file, path, descr = imp.find_module(modname, [subdir])
          if file:
              # Loading the module registers the plugin in
              # IPluginRegistry.
              try:
                  mod = imp.load_module(modname, file, path, descr)  # noqa
              except Exception as e:  # pragma: no cover
                  logger.exception(e)
              finally:
                  file.close()
      return IPluginRegistry.plugins
docs: Discover the plugin classes contained in Python files.
  
      Parameters
      ----------
  
      dirs : list
          List of directory names to scan.
  
      Returns
      -------
  
      plugins : list
          List of plugin classes.