def to_nnf(expr, simplify=True):
 if is_nnf(expr, simplify):
  return expr
 return expr.to_nnf(simplify)

def to_nnf ( expr , simplify = True ) : if is_nnf ( expr , simplify ) : return expr return expr . to_nnf ( simplify )
converts expr to negation normal form .