def METHOD_NAME(cmd, stdout=None, stderr=None):
    """Small subprocess helper function
    Originally based on this SO answer:
    http://stackoverflow.com/a/33542403/379593
    """
    if stdout is None:
        stdout = subprocess.PIPE
    if stderr is None:
        stderr = subprocess.PIPE
    process = subprocess.Popen(cmd, shell=True, stdout=stdout, stderr=stderr)
    o, e = process.communicate()
    return '' if o is None else o, '' if e is None else e, process.returncode