def gen(mimetype):
    """``gen`` is a decorator factory function, you just need to set
    a mimetype before using::

        @app.route('/')
        @gen('')
        def index():
            pass

    A full demo for creating a image stream is available on
    `GitHub <https://github.com/kxxoling/flask-video-streaming>`__ .
    """
    def streaming(func, *args, **kwargs):
        @wraps(func)
        def _():
            return Response(func(*args, **kwargs),
                            mimetype=mimetype)
        return _
    return streaming
``gen`` is a decorator factory function, you just need to set
    a mimetype before using::

        @app.route('/')
        @gen('')
        def index():
            pass

    A full demo for creating a image stream is available on
    `GitHub <https://github.com/kxxoling/flask-video-streaming>`__ .