@property
    def conn(self):
        if getattr(self, '_conn', None) is not None:
            if self._conn.get_transport() is not None:
                return self._conn
        try:
            ssh_info = self.init_ssh_key()
        except self.paramiko.SSHException as e:
            log.error("Couldn't connect to %s." % (self.config_id))
            log.error(unicode(e))
            sys.exit(1)
        self._conn = ssh_info['client']
        ssh_options = dict(
            (k.lower(), v)
            for k, v in ssh_info.items()
            if k[0].isupper())
        config_agent = self.sshconfig.get('forwardagent', 'no').lower() == 'yes'
        forward_agent = ssh_options.get('forwardagent', 'no').lower() == 'yes'
        self._conn._ploy_forward_agent = forward_agent or config_agent
        return self._conn
dataset/ETHPy150Open ployground/ploy/ploy/common.py/BaseInstance.conn/original