'Monitor a set of hosts (or all hosts by default),
and return their output, a line at a time.
hosts: (optional) set of hosts to monitor
timeoutms: (optional) timeout value in ms
returns: iterator which returns host, line'

def monitor(self, hosts=None, timeoutms=(-1)):

    if (hosts is None):
        hosts = self.hosts
    poller = select.poll()
    h1 = hosts[0]
    for host in hosts:
        poller.register(host.stdout)
    while True:
        ready = poller.poll(timeoutms)
        for (fd, event) in ready:
            host = h1.fdToNode(fd)
            if (event & select.POLLIN):
                line = host.readline()
                if (line is not None):
                    (yield (host, line))
        if ((not ready) and (timeoutms >= 0)):
            (yield (None, None))
