def __init__(self, host, env = {}):

        """ If env not passed explicitly, then 
            assume that its inherited from parent 
            class.
        """
        if env != {}:
           self.env = env

        self._jump_params()

        sshcmd = "ssh %s -L %s:%s:23" % \
            (self.jumpserver,self.jumpport,host)

        if self.DEBUG >= 3: print "ssh cmd: %s" % (sshcmd)

        """ Create SSH tunnel """
        self.tunnel = pexpect.spawn(sshcmd)

        if self.DEBUG >= 2: print "jump to %s:%s" % \
                (self.jumpserver,self.jumpport)

        if self.DEBUG >= 3: print "waiting for %s" % \
            (self.jumpprompt)

        """ Process response from jump server """
        expected_replies = [self.jumpprompt,\
            'Are you sure you want to continue connecting'\
            'ssword:']

        while 1:
            response = self.tunnel.expect(expected_replies)

            if response == 0:  # got prompt
                break

            """ Got ssh password, prompt, so no public 
                key encryption set up
            """
            if response == 1:  
                if self.env.has_key('SSHPASSWD'):
                    self.sshpassword = "%s\n" % \
                        (self.env['SSHPASSWD'])
                else:
                    raise JumpError, "no SSH Password"
                self._ssh_login()

            """ If prompted, add to known_hosts file """
            if response == 2:               
                self.tunnel.send("yes\n") 
     
        if self.DEBUG >= 1: print self.tunnel.before

        if self.DEBUG >= 3: print "tunnel %s:%s established" % \
                (self.jumpserver,self.jumpport)
 If env not passed explicitly, then 
            assume that its inherited from parent 
            class.
        
recipes/Python/576778_Automated_management_CLI/recipe-576778.py