def establish_ssh_tunnel(self):
localportlist = []<EOL>for (host, port) in self.hostportlist:<EOL><INDENT>localport = self.pick_unused_port()<EOL>self.tunnel.append(subprocess.Popen(<EOL>('<STR_LIT>', self.tunnelhost, '<STR_LIT>' % (localport, host, port))))<EOL>localportlist.append(('<STR_LIT:127.0.0.1>', localport))<EOL><DEDENT>return localportlist<EOL>
Establish an ssh tunnel for each local host and port
that can be used to communicate with the state host.