def METHOD_NAME(ifcond: Union[str, Dict[str, Any]],
           need_parens: bool) -> str:
    if isinstance(ifcond, str):
        return cond_fmt % ifcond
    assert isinstance(ifcond, dict) and len(ifcond) == 1
    if 'not' in ifcond:
        return not_fmt % METHOD_NAME(ifcond['not'], True)
    if 'all' in ifcond:
        gen = gen_infix(all_operator, ifcond['all'])
    else:
        gen = gen_infix(any_operator, ifcond['any'])
    if need_parens:
        gen = '(' + gen + ')'
    return gen