def apply_request_id_middleware(app):
    """Apply a :meth:`consensys_utils.wsgi.RequestIDMiddleware` on a Flask application

    :param app: Flask application
    :type app: :class:`flask.Flask`
    """
    if 'wsgi' in app.config and 'request_id' in app.config['wsgi']:
        from ..wsgi import RequestIDMiddleware
        app.wsgi_app = RequestIDMiddleware(app.wsgi_app, config=app.config[
            'wsgi']['request_id'])
