def METHOD_NAME(command, logfile=None, check=True, **kwargs):
    """Subprocess.call convenience wrapper."""
    returncode = 1
    full_args = {
        "args": shlex.split(command),
        "universal_newlines": True,
    }
    full_args.update(kwargs)
    if logfile:
        full_args["stdout"] = open(logfile, "w")
        full_args["stderr"] = subprocess.STDOUT
        returncode = subprocess.METHOD_NAME(**full_args)
        full_args["stdout"].close()
    else:
        returncode = subprocess.METHOD_NAME(**full_args)
    if check and returncode != 0:
        raise subprocess.CalledProcessError(returncode, full_args["args"], None)
    return returncode