<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def make_app(config=None):
 """ Factory function that creates a new `CoolmagicApplication` object. Optional WSGI middlewares should be applied here. """

    config = config or {}
    app = CoolMagicApplication(config)

    # static stuff
    app = SharedDataMiddleware(
        app, {"/public": path.join(path.dirname(__file__), "public")}
    )

    # clean up locals
    app = local_manager.make_middleware(app)

    return app