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

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

    Returns:
        Boolean representing connection status.

    """

    # A Discover must have been run before connecting to any devices. Do a quick one here
    # to ensure that it has been done.
    await discover(
        timeout=kwargs.get("timeout", 0.1), device=self.device, loop=self.loop
    )

    # Create system bus
    self._bus = await txdbus_connect(reactor, busAddress="system").asFuture(self.loop)
    # TODO: Handle path errors from txdbus/dbus
    self._device_path = get_device_object_path(self.device, self.address)

    def _services_resolved_callback(message):
        iface, changed, invalidated = message.body
        is_resolved = defs.DEVICE_INTERFACE and changed.get("ServicesResolved", False)
        if iface == is_resolved:
            logger.info("Services resolved.")
            self.services_resolved = True

    rule_id = await signals.listen_properties_changed(
        self._bus, self.loop, _services_resolved_callback
    )

    logger.debug(
        "Connecting to BLE device @ {0} with {1}".format(self.address, self.device)
    )
    try:
        await self._bus.callRemote(
            self._device_path,
            "Connect",
            interface="org.bluez.Device1",
            destination="org.bluez",
        ).asFuture(self.loop)
    except RemoteError as e:
        raise BleakError(str(e))

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

    # Get all services. This means making the actual connection.
    await self.get_services()
    properties = await self._get_device_properties()
    if not properties.get("Connected"):
        raise BleakError("Connection failed!")

    await self._bus.delMatch(rule_id).asFuture(self.loop)
    self._rules["PropChanged"] = await signals.listen_properties_changed(
        self._bus, self.loop, self._properties_changed_callback
    )
    return True


# Traceback (bleak.exc.BleakError)
/Users/zaytsev/PycharmProjects/bluetooth/venv/bin/python /Users/zaytsev/PycharmProjects/bluetooth/bleak_demo.py
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:Bluetooth powered on
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:Discovered device A0E49DB2-B7F1-4A65-AB2E-D75121192329: Unknown @ RSSI: -79
A0E49DB2-B7F1-4A65-AB2E-D75121192329: HUAWEI Band 2-b6e
DEBUG:bleak.backends.corebluetooth.client:Connecting to BLE device @ A0E49DB2-B7F1-4A65-AB2E-D75121192329
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:Successfully connected to device uuid A0E49DB2-B7F1-4A65-AB2E-D75121192329
WARNING:bleak.backends.corebluetooth.PeripheralDelegate:PeripheralDelegate is not compliant
DEBUG:bleak.backends.corebluetooth.client:Retrieving services...
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Services discovered
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service 180F
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Characteristics discovered
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A19
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A19
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service 180A
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Characteristics discovered
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A29
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A29
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A24
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A24
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A26
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A26
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A28
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A28
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A50
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A50
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service 180D
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Characteristics discovered
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A37
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A37
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic 2A38
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered 2A38
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service FE86
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Characteristics discovered
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic FE01
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered FE01
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic FE02
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered FE02
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic FE03
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered FE03
DEBUG:bleak.backends.corebluetooth.client:Retrieving descriptors for characteristic FE04
DEBUG:bleak.backends.corebluetooth.PeripheralDelegate:Descriptor discovered FE04
DEBUG:bleak.backends.corebluetooth.client:Retrieving services...
DEBUG:bleak.backends.corebluetooth.client:Retrieving characteristics for service 180F
DEBUG:bleak.backends.corebluetooth.CentralManagerDelegate:Peripheral Device disconnected!
Traceback (most recent call last):
File "/Users/zaytsev/PycharmProjects/bluetooth/bleak_demo.py", line 25, in <module>
loop.run_until_complete(ble_get_services(address, loop))
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
return future.result()
File "/Users/zaytsev/PycharmProjects/bluetooth/bleak_demo.py", line 18, in ble_get_services
svcs = await client.get_services()
File "/Users/zaytsev/PycharmProjects/bluetooth/venv/lib/python3.7/site-packages/bleak/backends/corebluetooth/client.py", line 118, in get_services
self.services.add_service(BleakGATTServiceCoreBluetooth(service))
File "/Users/zaytsev/PycharmProjects/bluetooth/venv/lib/python3.7/site-packages/bleak/backends/service.py", line 101, in add_service
"This service is already present in this BleakGATTServiceCollection!"
bleak.exc.BleakError: This service is already present in this BleakGATTServiceCollection!

# 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.

    """

    # A Discover must have been run before connecting to any devices. Do a quick one here
    # to ensure that it has been done.
    timeout = kwargs.get("timeout", self._timeout)
    await discover(timeout=timeout, device=self.device, loop=self.loop)

    # Create system bus
    self._bus = await txdbus_connect(reactor, busAddress="system").asFuture(self.loop)
    # TODO: Handle path errors from txdbus/dbus
    self._device_path = get_device_object_path(self.device, self.address)

    def _services_resolved_callback(message):
        iface, changed, invalidated = message.body
        is_resolved = defs.DEVICE_INTERFACE and changed.get("ServicesResolved", False)
        if iface == is_resolved:
            logger.info("Services resolved.")
            self.services_resolved = True

    rule_id = await signals.listen_properties_changed(
        self._bus, self.loop, _services_resolved_callback
    )

    logger.debug(
        "Connecting to BLE device @ {0} with {1}".format(self.address, self.device)
    )
    try:
        await self._bus.callRemote(
            self._device_path,
            "Connect",
            interface="org.bluez.Device1",
            destination="org.bluez",
        ).asFuture(self.loop)
    except RemoteError as e:
        raise BleakError(str(e))

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

    # Get all services. This means making the actual connection.
    await self.get_services()
    properties = await self._get_device_properties()
    if not properties.get("Connected"):
        raise BleakError("Connection failed!")

    await self._bus.delMatch(rule_id).asFuture(self.loop)
    self._rules["PropChanged"] = await signals.listen_properties_changed(
        self._bus, self.loop, self._properties_changed_callback
    )
    return True