def METHOD_NAME(args, env=None, cwd=None, on_exit=None, report_time=False):
    """Run a command with the given arguments.
    +   ``env`` – an environment in which to run.
    +   ``cwd`` – the path at which to run.
    +   ``on_exit`` – function to be executed on exit.
    +   ``report_time`` – whether to report how long it took to execute
        the command.
    """
    if env is None:
        env = get_env()
    start_time = datetime.datetime.now()
    completed = subprocess.run(args, env=env, cwd=cwd, shell=(os.name == 'nt'))
    if report_time:
        print(datetime.datetime.now() - start_time)
    if on_exit is not None:
        on_exit()
    if completed.returncode != 0:
        sys.exit(completed.returncode)