def getstatusoutput(cmd):
    """Get the status and output from the execution of a command in a shell.

    Returns: (Integer, String)

    """
    import subprocess
    pipe = subprocess.Popen(cmd, shell=True, universal_newlines=True,
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    output = str.join('', pipe.stdout.readlines())
    status = pipe.wait()
    if status is None:
        status = 0
    return status, output
