def fn_max(xc, p, contextItem, args):
    if len(args) != 1: raise XPathContext.FunctionNumArgs()
    comparands = xc.atomize( p, args[0] )
    try:
        if len(comparands) == 0: 
            return ()  # xpath allows empty sequence argument
        if any(isinstance(c, float) and math.isnan(c) for c in comparands):
            return NaN
        return max( comparands )
    except __HOLE__:
        raise XPathContext.FunctionArgType(1,"comparable values", comparands, errCode='err:FORG0001')
dataset/ETHPy150Open Arelle/Arelle/arelle/FunctionFn.py/fn_max