def METHOD_NAME(self, group_ids, group_to_channels):
    GroupChannels = Group.channels.through
    group_channels = GroupChannels.objects.using(
        self.database_connection_name
    ).filter(group_id__in=group_ids)
    channels_in_bulk = Channel.objects.using(self.database_connection_name).in_bulk(
        list(group_channels.values_list("channel_id", flat=True))
    )
    for group_id, channel_id in group_channels.values_list(
        "group_id", "channel_id"
    ):
        group_to_channels[group_id].append(channels_in_bulk[channel_id])
    return group_to_channels