def disconnect_async(self, conn_id, callback):
        """Asynchronously disconnect from a device that has previously been connected

        Args:
            conn_id (int): a unique identifier for this connection on the DeviceManager
                that owns this adapter.
            callback (callable): A function called as callback(conn_id, adapter_id, success, failure_reason)
            when the disconnection finishes.  Disconnection can only either succeed or timeout.
        """

        found_handle = None
        # Find the handle by connection id
        for handle, conn in self._connections.items():
            if conn['connection_id'] == conn_id:
                found_handle = handle

        if found_handle is None:
            callback(conn_id, self.id, False, 'Invalid connection_id')
            return

        self._command_task.async_command(['_disconnect', found_handle], self._on_disconnect,
                                         {'connection_id': conn_id, 'handle': found_handle,
                                          'callback': callback})
def disconnect_async ( self , conn_id , callback ) : found_handle = None for handle , conn in self . _connections . items ( ) : if conn [ 'connection_id' ] == conn_id : found_handle = handle if found_handle is None : callback ( conn_id , self . id , False , 'Invalid connection_id' ) return self . _command_task . async_command ( [ '_disconnect' , found_handle ] , self . _on_disconnect , { 'connection_id' : conn_id , 'handle' : found_handle , 'callback' : callback } )
Asynchronously disconnect from a device that has previously been connected

        Args:
            conn_id (int): a unique identifier for this connection on the DeviceManager
                that owns this adapter.
            callback (callable): A function called as callback(conn_id, adapter_id, success, failure_reason)
            when the disconnection finishes.  Disconnection can only either succeed or timeout.