you can just use `subprocess.check_output(cmd).strip()`