def on_close(self):
        for map_pk in self._maps_participants.keys():
            if self in self._maps_participants.get(map_pk, []):
                self._lock.acquire()

                # remove client from map
                try:
                    self._maps_participants[map_pk].remove(self)
                except __HOLE__:
                    pass

                # remove map if no participants remains on map
                try:
                    if not len(self._maps_participants[map_pk]):
                        del self._maps_participants[map_pk]
                except KeyError:
                    pass

                self._lock.release()

                self._braodcast_map_participants_count(map_pk)
dataset/ETHPy150Open ierror/BeautifulMind.io/beautifulmind/mindmaptornado/handlers.py/MindmapWebSocketHandler.on_close