def METHOD_NAME(self, assignment, exchange, cache, flags=None):
    cmd = [
        "submit", assignment,
        "--course", "abc101",
        "--Exchange.cache={}".format(cache),
        "--Exchange.root={}".format(exchange)
    ]
    if flags is not None:
        cmd.extend(flags)
    run_nbgrader(cmd)