def METHOD_NAME(module_paths, config_file=None):
    flake8_opts = ["--statistics"]
    if config_file:
        flake8_opts.append("--append-config={}".format(config_file))
    flake8_opts.extend(module_paths)
    app = application.Application()
    app.run(flake8_opts)
    try:
        app.exit()
    except SystemExit:
        pass
    if app.result_count > 0 or app.catastrophic_failure:
        sys.exit(app.result_count or 1)