<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def connect(self, poll_devices=False, device=None, workdir=None):
 """Connect to the IM."""

        await self.aldb_load_lock.acquire()
        device = self.host if self.host else self.device
        _LOGGING.info('Connecting to Insteon Modem at %s', device)
        self.device = device if device else self.device
        self.workdir = workdir if workdir else self.workdir
        conn = await insteonplm.Connection.create(
            device=self.device,
            host=self.host,
            port=self.port,
            username=self.username,
            password=self.password,
            loop=self.loop,
            poll_devices=poll_devices,
            workdir=self.workdir)
        _LOGGING.info('Connecton made to Insteon Modem at %s', device)
        conn.protocol.add_device_callback(self.async_new_device_callback)
        conn.protocol.add_all_link_done_callback(
            self.async_aldb_loaded_callback)
        self.plm = conn.protocol
        await self.aldb_load_lock
        if self.aldb_load_lock.locked():
            self.aldb_load_lock.release()