def boolean(xc, p, source):
    if isinstance(source,bool):
        return source
    elif isinstance(source, _NUM_TYPES):
        if source == 1:
            return True
        elif source == 0:
            return False
    elif isinstance(source,str):
        b = source.lower()
        if b in ('true','yes'):
            return True
        elif b in ('false','no'):
            return False
    raise FORG0001
dataset/ETHPy150Open Arelle/Arelle/arelle/FunctionXs.py/boolean/original