def _Disconnect(self):
    if hasattr(self, '_connection'):
      try:
        self._connection.child.send('exit\r')
        # Loose prompt RE as prompt changes after first exit.
        self._connection.child.expect(self._success,
                                      timeout=self.timeout_act_user)
        self._connection.child.send('exit\r')
        self._connection.child.expect(self._connection.exit_list,
                                      timeout=self.timeout_act_user)
        self.connected = False
      except (pexpect.EOF, pexpect.TIMEOUT) as e:
        self.connected = False
        raise exceptions.DisconnectError('%s: %s' % (e.__class__, str(e)))
dataset/ETHPy150Open google/capirca/tools/ldpush/aruba.py/ArubaDevice._Disconnect/original