# Buggy code
async def connect(self) -> bool:
    """Connect to the specified GATT server.

    Returns:
        Boolean representing connection status.

    """
    # Try to find the desired device.
    devices = await discover(2.0, loop=self.loop)
    sought_device = list(
        filter(lambda x: x.address.upper() == self.address.upper(), devices)
    )

    if len(sought_device):
        self._device_info = sought_device[0].details
    else:
        raise BleakError("Device with address {0} was not found.".format(self.address))

    logger.debug("Connecting to BLE device @ {0}".format(self.address))

    self._requester = await wrap_IAsyncOperation(
        IAsyncOperation[BluetoothLEDevice](
            BluetoothLEDevice.FromBluetoothAddressAsync(
                UInt64(self._device_info.BluetoothAddress)
            )
        ),
        return_type=BluetoothLEDevice,
        loop=self.loop,
    )

    def _ConnectionStatusChanged_Handler(sender, args):
        logger.debug("_ConnectionStatusChanged_Handler: " + args.ToString())

    self._requester.ConnectionStatusChanged += _ConnectionStatusChanged_Handler

    # Obtain services, which also leads to connection being established.
    await self.get_services()
    await asyncio.sleep(0.2, loop=self.loop)
    connected = await self.is_connected()
    if connected:
        logger.debug("Connection successful.")
    else:
        raise BleakError("Connection to {0} was not successful!".format(self.address))

    return connected


# Traceback (builtins.AttributeError)
Unhandled Error
Traceback (most recent call last):
File "/home/usr/dir/virtualEnv/lib/python3.6/site-packages/txdbus/protocol.py", line 141, in dataReceived
self.rawDBusMessageReceived(raw_msg)
File "/home/usr/dir/virtualEnv/lib/python3.6/site-packages/txdbus/protocol.py", line 262, in rawDBusMessageReceived
self.signalReceived(m)
File "/home/usr/dir/virtualEnv/lib/python3.6/site-packages/txdbus/client.py", line 643, in signalReceived
self.router.routeMessage(msig)
File "/home/usr/dir/virtualEnv/lib/python3.6/site-packages/txdbus/router.py", line 128, in routeMessage
r.match(m)
--- <exception caught here> ---
File "/home/usr/dir/virtualEnv/lib/python3.6/site-packages/txdbus/router.py", line 67, in match
self.callback(m)
File "/home/usr/dir/virtualEnv/lib/python3.6/site-packages/bleak/backends/bluezdbus/discovery.py", line 109, in parse_msg
*_device_info(msg_path, devices.get(msg_path))
File "/home/usr/dir/virtualEnv/lib/python3.6/site-packages/bleak/backends/bluezdbus/discovery.py", line 39, in _device_info
name = props.get("Name", props.get("Alias", path.split("/")[-1]))
builtins.AttributeError: 'NoneType' object has no attribute 'get'

# Fixed code
async def connect(self, **kwargs) -> bool:
    """Connect to the specified GATT server.

    Keyword Args:
        timeout (float): Timeout for required ``discover`` call. Defaults to 2.0.

    Returns:
        Boolean representing connection status.

    """
    # Try to find the desired device.
    devices = await discover(timeout=kwargs.get("timeout", 2.0), loop=self.loop)
    sought_device = list(
        filter(lambda x: x.address.upper() == self.address.upper(), devices)
    )

    if len(sought_device):
        self._device_info = sought_device[0].details
    else:
        raise BleakError("Device with address {0} was not found.".format(self.address))

    logger.debug("Connecting to BLE device @ {0}".format(self.address))

    args = [UInt64(self._device_info.BluetoothAddress)]
    if self._address_type is not None:
        args.append(
            BluetoothAddressType.Public
            if self._address_type == "public"
            else BluetoothAddressType.Random
        )
    self._requester = await wrap_IAsyncOperation(
        IAsyncOperation[BluetoothLEDevice](
            BluetoothLEDevice.FromBluetoothAddressAsync(*args)
        ),
        return_type=BluetoothLEDevice,
        loop=self.loop,
    )

    def _ConnectionStatusChanged_Handler(sender, args):
        logger.debug("_ConnectionStatusChanged_Handler: " + args.ToString())

    self._requester.ConnectionStatusChanged += _ConnectionStatusChanged_Handler

    # Obtain services, which also leads to connection being established.
    services = await self.get_services()
    connected = False
    if self._services_resolved:
        # If services has been resolved, then we assume that we are connected. This is due to
        # some issues with getting `is_connected` to give correct response here.
        connected = True
    else:
        for _ in range(5):
            await asyncio.sleep(0.2, loop=self.loop)
            connected = await self.is_connected()
            if connected:
                break

    if connected:
        logger.debug("Connection successful.")
    else:
        raise BleakError("Connection to {0} was not successful!".format(self.address))

    return connected