Executes the given shell command and returns its output.

def shell_exec(command):
    """Executes the given shell command and returns its output."""
    out = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]
    return out.decode('utf-8')