import socket
import logging
import subprocess


def cmd(cmd):
    """
    Execute a command, return stdout and stderr in tuple
    """
    logging.debug("Execute Command: %s" % cmd)
    process = None
    try:
        process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
        return (process.stdout.read(), process.stderr.read())
    finally:
        if process is not None:
            process.stdout.close()
            process.stderr.close()


def get_host_name():
    return socket.gethostname()

@@ -339,17 +339,16 @@
 urn 
-(
 process.
 stdo
@@ -347,44 +347,20 @@
 ess.
-stdout.read(), process.stderr.read()
+communicate(
 )%0A  

Fix cmd function bug