docs: def _loader(app, init_func, entry_points=None, modules=None):
      """Run generic loader.
  
      Used to load and initialize entry points and modules using an custom
      initialization function.
  
      .. versionadded: 1.0.0
      """
      if entry_points:
          for entry_point in entry_points:
              for ep in pkg_resources.iter_entry_points(entry_point):
                  try:
                      init_func(ep.load())
                  except Exception:
                      app.logger.error(
                          'Failed to initialize entry point: {0}'.format(ep))
                      raise
      if modules:
          for m in modules:
              try:
                  init_func(m)
              except Exception:
                  app.logger.error('Failed to initialize module: {0}'.format(m))
                  raise