async def serialize(self, address_manager: AddressManager):
    metadata = []
    nodes = []
    new_table_entries = []
    metadata.append(('key', str(address_manager.key)))
    unique_ids = {}
    count_ids = 0
    for (node_id, info) in address_manager.map_info.items():
        unique_ids[node_id] = count_ids
        if (info.ref_count > 0):
            assert (count_ids != address_manager.new_count)
            nodes.append((count_ids, info))
            count_ids += 1
    metadata.append(('new_count', str(count_ids)))
    tried_ids = 0
    for (node_id, info) in address_manager.map_info.items():
        if info.is_tried:
            assert (info is not None)
            assert (tried_ids != address_manager.tried_count)
            nodes.append((count_ids, info))
            count_ids += 1
            tried_ids += 1
    metadata.append(('tried_count', str(tried_ids)))
    for bucket in range(NEW_BUCKET_COUNT):
        for i in range(BUCKET_SIZE):
            if (address_manager.new_matrix[bucket][i] != (- 1)):
                index = unique_ids[address_manager.new_matrix[bucket][i]]
                new_table_entries.append((index, bucket))
    (await self.clear())
    (await self.set_metadata(metadata))
    (await self.set_nodes(nodes))
    (await self.set_new_table(new_table_entries))
async def serialize(self, address_manager: AddressManager):
    metadata = []
    nodes = []
    new_table_entries = []
    metadata.append(('key', str(address_manager.key)))
    unique_ids = {}
    count_ids = 0
    for (node_id, info) in address_manager.map_info.items():
        unique_ids[node_id] = count_ids
        if (info.ref_count > 0):
            assert (count_ids != address_manager.new_count)
            nodes.append((count_ids, info))
            count_ids += 1
    metadata.append(('new_count', str(count_ids)))
    tried_ids = 0
    for (node_id, info) in address_manager.map_info.items():
        if info.is_tried:
            assert (info is not None)
            assert (tried_ids != address_manager.tried_count)
            nodes.append((count_ids, info))
            count_ids += 1
            tried_ids += 1
    metadata.append(('tried_count', str(tried_ids)))
    for bucket in range(NEW_BUCKET_COUNT):
        for i in range(BUCKET_SIZE):
            if (address_manager.new_matrix[bucket][i] != (- 1)):
                index = unique_ids[address_manager.new_matrix[bucket][i]]
                new_table_entries.append((index, bucket))
    (await self.clear())
    (await self.set_metadata(metadata))
    (await self.set_nodes(nodes))
    (await self.set_new_table(new_table_entries))