# Buggy code
async def disconnect(self) -> bool:
    """Disconnect from the specified GATT server.

    Returns:
        Boolean representing if device is disconnected.

    """
    logger.debug("Disconnecting from BLE device...")
    # Remove notifications. Remove them first in the BleakBridge and then clear
    # remaining notifications in Python as well.
    for characteristic in self.services.characteristics.values():
        self._bridge.RemoveValueChangedCallback(characteristic.obj)
    self._notification_callbacks.clear()

    # Dispose all service components that we have requested and created.
    for service in self.services:
        service.obj.Dispose()
    self.services = BleakGATTServiceCollection()
    self._services_resolved = False

    # Dispose of the BluetoothLEDevice and see that the connection
    # status is now Disconnected.
    self._requester.Dispose()
    is_disconnected = (
        self._requester.ConnectionStatus == BluetoothConnectionStatus.Disconnected
    )
    self._requester = None

    # Set device info to None as well.
    self._device_info = None

    # Finally, dispose of the Bleak Bridge as well.
    self._bridge.Dispose()
    self._bridge = None

    return is_disconnected


# Traceback (AttributeError)
Connecting to mac: [mac here]
Poking services...
Disconnect on device end now...
0...
1...
2...
3...
4...
Waiting for device to indicate disconnection... ensure it is ready to reconnect
0...
1...
2...
3...
4...
5...
6...
7...
8...
9...
10...
11...
12...
13...
14...
Reconnecting...
Poking services...
Disconnecting...
Waiting for device to indicate disconnection...
0...
1...
2...
3...
4...
5...
6...
7...
8...
9...
At this point, nothing has happened and the device still shows as connected... trying again
Disconnecting...
Traceback (most recent call last):
File "c:/Users/user/Documents/ble/test.py", line 338, in <module>
test.start()
File "c:/Users/user/Documents/ble/test.py", line 330, in start
self.loop.run_until_complete(self.__loop())
File "C:\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "c:/Users/user/Documents/ble/test.py", line 323, in __loop
await self.__stdin_msg_handler(msgs)
File "c:/Users/user/Documents/ble/test.py", line 306, in __stdin_msg_handler
await self.__attributeerror_test(mac)
File "c:/Users/user/Documents/ble/test.py", line 197, in __attributeerror_test
await client.disconnect() # this will throw an AttributeError
File "C:\Python38\lib\site-packages\bleak\backends\dotnet\client.py", line 230, in disconnect
self._requester.Dispose()
AttributeError: 'NoneType' object has no attribute 'Dispose'

# Fixed code
async def disconnect(self) -> bool:
    """Disconnect from the specified GATT server.

    Returns:
        Boolean representing if device is disconnected.

    Raises:
        asyncio.TimeoutError: If device did not disconnect with 10 seconds.

    """
    logger.debug("Disconnecting from BLE device...")
    # Remove notifications. Remove them first in the BleakBridge and then clear
    # remaining notifications in Python as well.
    for characteristic in self.services.characteristics.values():
        self._bridge.RemoveValueChangedCallback(characteristic.obj)
    self._notification_callbacks.clear()

    # Dispose all service components that we have requested and created.
    for service in self.services:
        service.obj.Dispose()
    self.services = BleakGATTServiceCollection()
    self._services_resolved = False

    # Dispose of the BluetoothLEDevice and see that the connection
    # status is now Disconnected.
    if self._requester:
        event = asyncio.Event()
        self._disconnect_events.append(event)
        try:
            self._requester.Dispose()
            await asyncio.wait_for(event.wait(), timeout=10)
        finally:
            self._disconnect_events.remove(event)

    # Set device info to None as well.
    self._device_info = None

    # Finally, dispose of the Bleak Bridge as well.
    self._bridge.Dispose()
    self._bridge = None

    return True