'Make sure no controllers are running on our port'

def checkListening(self):

    (out, _err, returnCode) = errRun('which    telnet')
    if (('telnet' not in out) or (returnCode != 0)):
        raise Exception('Error    running    telnet    to    check    for    listening    controllers;    please    check    that    it    is    installed.')
    listening = self.cmd(('echo    A    |    telnet    -e    A    %s    %d' % (self.ip, self.port)))
    if ('Connected' in listening):
        servers = self.cmd('netstat    -natp').split('\n')
        pstr = (':%d    ' % self.port)
        clist = (servers[0:1] + [s for s in servers if (pstr in s)])
        raise Exception((('Please    shut    down    the    controller    which    is    running    on    port    %d:\n' % self.port) + '\n'.join(clist)))
