def gunicorn_adapter(host, port):
    from gunicorn import version_info

    if version_info < (0, 9, 0):
        from gunicorn.arbiter import Arbiter
        from gunicorn.config import Config
        arbiter = Arbiter(Config({'bind': "%s:%d" % (host, int(port)), 'workers': 4}), handle_request)
        arbiter.run()
    else:
        from gunicorn.app.base import Application

        class IttyApplication(Application):
            def init(self, parser, opts, args):
                return {
                    'bind': '{0}:{1}'.format(host, port),
                    'workers': 4
                }

            def load(self):
                return handle_request

        IttyApplication().run()
dataset/ETHPy150Open toastdriven/itty/itty.py/gunicorn_adapter/original