# Buggy code
async def start_notify(
    self, _uuid: str, callback: Callable[[str, Any], Any], **kwargs
) -> None:
    """Activate notifications/indications on a characteristic.

    Callbacks must accept two inputs. The first will be a uuid string
    object and the second will be a bytearray.

    .. code-block:: python

        def callback(sender, data):
            print(f"{sender}: {data}")
        client.start_notify(char_uuid, callback)

    Args:
        _uuid (str or UUID): The uuid of the characteristics to start notification on.
        callback (function): The function to be called on notification.

    Keyword Args:
        notification_wrapper (bool): Set to `False` to avoid parsing of
            notification to bytearray.

    """
    _wrap = kwargs.get("notification_wrapper", True)
    characteristic = self.services.get_characteristic(str(_uuid))
    if not characteristic:
        # Special handling for BlueZ >= 5.48, where Battery Service (0000180f-0000-1000-8000-00805f9b34fb:)
        # has been moved to interface org.bluez.Battery1 instead of as a regular service.
        # The org.bluez.Battery1 on the other hand does not provide a notification method, so here we cannot
        # provide this functionality...
        # See https://kernel.googlesource.com/pub/scm/bluetooth/bluez/+/refs/tags/5.48/doc/battery-api.txt
        if _uuid == "00002a19-0000-1000-8000-00805f9b34fb" and (
            self._bluez_version[0] == 5 and self._bluez_version[1] >= 48
        ):
            raise BleakError(
                "Notifications on Battery Level Char ({0}) is not "
                "possible in BlueZ >= 5.48. Use regular read instead.".format(_uuid)
            )
        raise BleakError(
            "Characteristic with UUID {0} could not be found!".format(_uuid)
        )
    await self._bus.callRemote(
        characteristic.path,
        "StartNotify",
        interface=defs.GATT_CHARACTERISTIC_INTERFACE,
        destination=defs.BLUEZ_SERVICE,
        signature="",
        body=[],
        returnSignature="",
    ).asFuture(self.loop)

    if _wrap:
        self._notification_callbacks[characteristic.path] = _data_notification_wrapper(
            callback, self._char_path_to_uuid
        )  # noqa | E123 error in flake8...
    else:
        self._notification_callbacks[characteristic.path] = (
            _regular_notification_wrapper(callback, self._char_path_to_uuid)
        )  # noqa | E123 error in flake8...


# Traceback (txdbus.error.RemoteError)
Traceback (most recent call last):
File "discover.py", line 29, in <module>
loop.run_until_complete(run())
File "/usr/lib64/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "discover.py", line 22, in run
devices = await discover(timeout=1)
File "/home/joe/code/proglove/python/bleak/bleak/backends/bluezdbus/discovery.py", line 125, in discover
bus = await client.connect(reactor, "system").asFuture(loop)
txdbus.error.RemoteError: org.freedesktop.DBus.Error.LimitsExceeded: The maximum number of active connections for UID 1000 has been reached

# Fixed code
async def start_notify(
    self, _uuid: str, callback: Callable[[str, Any], Any], **kwargs
) -> None:
    """Activate notifications/indications on a characteristic.

    Callbacks must accept two inputs. The first will be a uuid string
    object and the second will be a bytearray.

    .. code-block:: python

        def callback(sender, data):
            print(f"{sender}: {data}")
        client.start_notify(char_uuid, callback)

    Args:
        _uuid (str or UUID): The uuid of the characteristics to start notification on.
        callback (function): The function to be called on notification.

    Keyword Args:
        notification_wrapper (bool): Set to `False` to avoid parsing of
            notification to bytearray.

    """
    _wrap = kwargs.get("notification_wrapper", True)
    characteristic = self.services.get_characteristic(str(_uuid))
    if not characteristic:
        # Special handling for BlueZ >= 5.48, where Battery Service (0000180f-0000-1000-8000-00805f9b34fb:)
        # has been moved to interface org.bluez.Battery1 instead of as a regular service.
        # The org.bluez.Battery1 on the other hand does not provide a notification method, so here we cannot
        # provide this functionality...
        # See https://kernel.googlesource.com/pub/scm/bluetooth/bluez/+/refs/tags/5.48/doc/battery-api.txt
        if _uuid == "00002a19-0000-1000-8000-00805f9b34fb" and (
            self._bluez_version[0] == 5 and self._bluez_version[1] >= 48
        ):
            raise BleakError(
                "Notifications on Battery Level Char ({0}) is not "
                "possible in BlueZ >= 5.48. Use regular read instead.".format(_uuid)
            )
        raise BleakError(
            "Characteristic with UUID {0} could not be found!".format(_uuid)
        )
    await self._bus.callRemote(
        characteristic.path,
        "StartNotify",
        interface=defs.GATT_CHARACTERISTIC_INTERFACE,
        destination=defs.BLUEZ_SERVICE,
        signature="",
        body=[],
        returnSignature="",
    ).asFuture(self.loop)

    if _wrap:
        self._notification_callbacks[characteristic.path] = _data_notification_wrapper(
            callback, self._char_path_to_uuid
        )  # noqa | E123 error in flake8...
    else:
        self._notification_callbacks[characteristic.path] = (
            _regular_notification_wrapper(callback, self._char_path_to_uuid)
        )  # noqa | E123 error in flake8...

    self._subscriptions.append(_uuid)