def apply_middleware(*middlewares):
def inner(create_store_):<EOL><INDENT>def create_wrapper(reducer, enhancer=None):<EOL><INDENT>store = create_store_(reducer, enhancer)<EOL>dispatch = store['<STR_LIT>']<EOL>middleware_api = {<EOL>'<STR_LIT>': store['<STR_LIT>'],<EOL>'<STR_LIT>': lambda action: dispatch(action),<EOL>}<EOL>chain = [mw(middleware_api) for mw in middlewares]<EOL>dispatch = compose(*chain)(store['<STR_LIT>'])<EOL>return extend(store, {'<STR_LIT>': dispatch})<EOL><DEDENT>return create_wrapper<EOL><DEDENT>return inner<EOL>
creates an enhancer function composed of middleware

Args:
    *middlewares: list of middleware functions to apply

Returns:
    an enhancer for subsequent calls to create_store()