code: def disconnect(self, device):
          
          # self.device.ctrl.sendcontrol(']')
          # self.device.ctrl.sendline('quit')
          self.log("TELNET disconnect")
          try:
              self.device.ctrl.send(chr(4))
          except OSError:
              self.log("Protocol already disconnected")
docs: Disconnect using protocol specific method.