def table_filtered_to_id(table: Type[BaseCount], key_id: int) -> QuerySet:
    if (table == RealmCount):
        return RealmCount.objects.filter(realm_id=key_id)
    elif (table == UserCount):
        return UserCount.objects.filter(user_id=key_id)
    elif (table == StreamCount):
        return StreamCount.objects.filter(stream_id=key_id)
    elif (table == InstallationCount):
        return InstallationCount.objects.all()
    elif (settings.ZILENCER_ENABLED and (table == RemoteInstallationCount)):
        return RemoteInstallationCount.objects.filter(server_id=key_id)
    elif (settings.ZILENCER_ENABLED and (table == RemoteRealmCount)):
        return RemoteRealmCount.objects.filter(realm_id=key_id)
    else:
        raise AssertionError(f'Unknown table: {table}')
def table_filtered_to_id(table: Type[BaseCount], key_id: int) -> QuerySet:
    if (table == RealmCount):
        return RealmCount.objects.filter(realm_id=key_id)
    elif (table == UserCount):
        return UserCount.objects.filter(user_id=key_id)
    elif (table == StreamCount):
        return StreamCount.objects.filter(stream_id=key_id)
    elif (table == InstallationCount):
        return InstallationCount.objects.all()
    elif (settings.ZILENCER_ENABLED and (table == RemoteInstallationCount)):
        return RemoteInstallationCount.objects.filter(server_id=key_id)
    elif (settings.ZILENCER_ENABLED and (table == RemoteRealmCount)):
        return RemoteRealmCount.objects.filter(realm_id=key_id)
    else:
        raise AssertionError(f'Unknown table: {table}')