import os

import cfgtools
from typing import Optional

conference_type = None


def get_close_operator_conference_type():
    # type: (...) -> Optional[str]

    global conference_type

    if conference_type is not None:
        return conference_type

    config = cfgtools.read(os.environ["LOADERCFG"])
    customizations = config.find_group("Customizations")
    if customizations is not None:
        close_operator_conference_type = config.find_value("Customizations.CloseOperatorConferenceType")
        if close_operator_conference_type:
            conference_type = close_operator_conference_type.lower()
            return conference_type

    return None
