def get_parent_active_language_choices(parent_object, exclude_current=False):
    assert parent_object is not None, "Missing parent_object!"

    from .db import ContentItem
    qs = ContentItem.objects \
        .parent(parent_object, limit_parent_language=False) \
        .values_list('language_code', flat=True).distinct()

    languages = set(qs)

    if exclude_current:
        parent_lang = get_parent_language_code(parent_object)
        try:
            languages.remove(parent_lang)
        except KeyError:
            pass

    # No multithreading issue here, object is instantiated for this user only.
    choices = [(lang, str(get_language_title(lang))) for lang in languages if lang]
    choices.sort(key=lambda tup: tup[1])
    return choices
Reguest for port disconnect
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/models/managers.py/get_parent_active_language_choices--crossover with--dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/calvin_proto.py/CalvinProto.port_disconnect_handler