'Establish SSH connection to the network device
Timeout will generate a NetMikoTimeoutException
Authentication failure will generate a NetMikoAuthenticationException
width and height are needed for Fortinet paging setting.'

def establish_connection(self, width=None, height=None):

    if (self.protocol == u'telnet'):
        self.remote_conn = telnetlib.Telnet(self.host, port=self.port, timeout=self.timeout)
        self.telnet_login()
    elif (self.protocol == u'ssh'):
        ssh_connect_params = self._connect_params_dict()
        self.remote_conn_pre = self._build_ssh_client()
        try:
            self.remote_conn_pre.connect(**ssh_connect_params)
        except socket.error:
            msg = u'Connection    to    device    timed-out:    {device_type}    {ip}:{port}'.format(device_type=self.device_type, ip=self.host, port=self.port)
            raise NetMikoTimeoutException(msg)
        except paramiko.ssh_exception.AuthenticationException as auth_err:
            msg = u'Authentication    failure:    unable    to    connect    {device_type}    {ip}:{port}'.format(device_type=self.device_type, ip=self.host, port=self.port)
            msg += (u'\n' + str(auth_err))
            raise NetMikoAuthenticationException(msg)
        if self.verbose:
            print(u'SSH    connection    established    to    {0}:{1}'.format(self.host, self.port))
        if (width and height):
            self.remote_conn = self.remote_conn_pre.invoke_shell(term=u'vt100', width=width, height=height)
        else:
            self.remote_conn = self.remote_conn_pre.invoke_shell()
        self.remote_conn.settimeout(self.timeout)
        if self.keepalive:
            self.remote_conn.transport.set_keepalive(self.keepalive)
        self.special_login_handler()
        if self.verbose:
            print(u'Interactive    SSH    session    established')
    return u''
