code: def gen_init(modules):
      yield "#!/usr/bin/env python"
      yield "# -*- encoding: utf-8 -*-"
      yield "#"
      yield "# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py"
      yield "# Copyright 2016 H2O.ai;  Apache License Version 2.0 (see LICENSE for details)"
      yield "#"
      yield "import inspect"
      yield "import sys"
      yield ""
      module_strs = []
      # imports estimators
      for full_module, module, clz, category in sorted(modules):
          if module in ["grid", "automl"]:
              continue
          module_strs.append('"%s"' % clz)
          yield "from .%s import %s" % (module, clz)
      # global methods for h2o.estimators module
      yield """
  
  module = sys.modules[__name__]
  
  
  def _algo_for_estimator_(shortname, cls):
      if shortname == 'H2OAutoEncoderEstimator':
          return 'autoencoder'
      return cls.algo
  
  
  _estimator_cls_by_algo_ = {_algo_for_estimator_(name, cls): cls
                             for name, cls in inspect.getmembers(module, inspect.isclass)
                             if hasattr(cls, 'algo')}
  
  
  def create_estimator(algo, **params):
      if algo not in _estimator_cls_by_algo_:
          raise ValueError("Unknown algo type: " + algo)
      return _estimator_cls_by_algo_[algo](**params)
  
  """
      # auto-exports
      yield "__all__ = ("
      yield bi.wrap('"create_estimator",', indent=" " * 4)
      yield bi.wrap(", ".join(module_strs), indent=" " * 4)
      yield ")"
  
imports: from copy import deepcopy
  from functools import partial
  from io import StringIO
  from inspect import getsource
  from pprint import pformat
  import sys
  import bindings
  from custom import get_customizations_for, reformat_block
label_desc: Use image node_id 9 for calling a global function with example usage: gen_init(modules) without return types