Run shell command and capture output using python
def run_terminal(command): p = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() return out