<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_app(*, debug=False, threads=1, bigchaindb_factory=None):
 """Return an instance of the Flask application. Args: debug (bool):
 a flag to activate the debug mode for the app (default: False). threads (int):
 number of threads to use Return: an instance of the Flask application. """


    if not bigchaindb_factory:
        bigchaindb_factory = BigchainDB

    app = Flask(__name__)
    app.wsgi_app = StripContentTypeMiddleware(app.wsgi_app)

    CORS(app)

    app.debug = debug

    app.config['bigchain_pool'] = utils.pool(bigchaindb_factory, size=threads)

    add_routes(app)

    return app