def sqrtdenest(expr, max_iter=3):
 expr = expand_mul(sympify(expr))
 for i in range(max_iter):
  z = _sqrtdenest0(expr)
  if (expr == z):
   return expr
  expr = z
 return expr

def sqrtdenest ( expr , max_iter = 3 ) : expr = expand_mul ( sympify ( expr ) ) for i in range ( max_iter ) : z = _sqrtdenest0 ( expr ) if ( expr == z ) : return expr expr = z return expr
denests sqrts in an expression that contain other square roots if possible .