def __init__(self, *args, **kwargs):

        if "logger" in kwargs:
            self.logger = kwargs.pop("logger")
        
        mode = "PDU"
        if "mode" in kwargs:
            mode = kwargs.pop("mode")
        
        # if a ready-made device was provided, store it -- self.connect
        # will see that we're already connected, and do nothing. we'll
        # just assume it quacks like a serial port
        if "device" in kwargs:
            self.device = kwargs.pop("device")

            # if a device is given, the other args are never
            # used, so were probably included by mistake.
            if len(args) or len(kwargs):
                raise(TypeError("__init__() does not accept other arguments when a 'device' is given"))

        # for regular serial connections, store the connection args, since
        # we might need to recreate the serial connection again later
        else:
            self.device_args = args
            self.device_kwargs = kwargs

        # to cache parts of multi-part messages
        # until the last part is delivered
        self.multipart = {}

        # to store unhandled incoming messages
        self.incoming_queue = []
        
        if mode.lower() == "text":
            self.smshandler = TextSmsHandler(self)
        else:
            self.smshandler = PduSmsHandler(self)
        # boot the device on init, to fail as
        # early as possible if it can't be opened
        self.boot()
Creates, connects to, and boots a GSM Modem. All of the arguments
dataset/ETHPy150Open sahana/eden/modules/pygsm/gsmmodem.py/GsmModem.__init__