Execute cmd, check exit code, return stdout

def shell(cmd, **kwargs):
    """Execute cmd, check exit code, return stdout"""
    logger.debug("$ %s", cmd)
    return subprocess.check_output(cmd, shell=True, **kwargs)