'Evaluate a Python expression.
Node names may be used, e.g.: py h1.cmd(\'ls\')'

def do_py(self, line):

    try:
        result = eval(line, globals(), self.getLocals())
        if (not result):
            return
        elif isinstance(result, str):
            output((result + '\n'))
        else:
            output((repr(result) + '\n'))
    except Exception as e:
        output((str(e) + '\n'))
