'Disconnects from the modem.'

def disconnect(self):

    self._log('Disconnecting')
    if (hasattr(self, 'device') and (self.device is None)):
        with self.modem_lock:
            if self.device.isOpen():
                self.device.close()
                self.device = None
                return True
    return False
