def METHOD_NAME(addon, properties):
    translation_ids_gen = (getattr(addon, prop + '_id', None) for prop in properties)
    translation_ids = [id_ for id_ in translation_ids_gen if id_]
    # Just get all the values together to make it simplier
    return {str(value) for value in Translation.objects.filter(id__in=translation_ids)}