def call(xc, p, qname, contextItem, args):
    try:
        cfSig = xc.modelXbrl.modelCustomFunctionSignatures[qname, len(args)]
        if cfSig is not None and cfSig.customFunctionImplementation is not None:
            return callCfi(xc, p, qname, cfSig, contextItem, args)
        elif qname in xc.customFunctions: # plug in method custom functions 
            return xc.customFunctions[qname](xc, p, contextItem, args) # use plug-in's method
        elif qname not in customFunctions: # compiled functions in this module
            raise fnFunctionNotAvailable
        return customFunctions[qname](xc, p, contextItem, args)
    except (fnFunctionNotAvailable, __HOLE__):
        raise XPathContext.FunctionNotAvailable("custom function:{0}".format(str(qname)))
dataset/ETHPy150Open Arelle/Arelle/arelle/FunctionCustom.py/call