import os

import cfgtools

pre_account_allow_printing = None


def get_pre_account_allow_printing():
    # type: (...) -> bool

    global pre_account_allow_printing

    if pre_account_allow_printing is None:
        config = cfgtools.read(os.environ["LOADERCFG"])
        pre_account_allow_printing = config.find_value("PreAccountConfig.AllowPrinting", "true")

    return pre_account_allow_printing.lower() == "true"
