code: def mpf_sqrt(s, prec, rnd=round_fast):
      """
      Compute the square root of a nonnegative mpf value. The
      result is correctly rounded.
      """
      sign, man, exp, bc = s
      if sign:
          raise ComplexResult("square root of a negative number")
      if not man:
          return s
      if exp & 1:
          exp -= 1
          man <<= 1
          bc += 1
      elif man == 1:
          return normalize1(sign, man, exp // 2, bc, prec, rnd)
      shift = max(4, 2 * prec - bc + 4)
      shift += shift & 1
      if rnd in "fd":
          man = isqrt(man << shift)
      else:
          man, rem = sqrtrem(man << shift)
          # Perturb up
          if rem:
              man = (man << 1) + 1
              shift += 2
      return from_man_exp(man, (exp - shift) // 2, prec, rnd)
  
imports: import math
  from bisect import bisect
  import sys
  from .backend import MPZ, MPZ_TYPE, MPZ_ZERO, MPZ_ONE, MPZ_TWO, MPZ_FIVE, BACKEND, STRICT, HASH_MODULUS, HASH_BITS, gmpy, sage, sage_utils
  from .libintmath import giant_steps, trailtable, bctable, lshift, rshift, bitcount, trailing, sqrt_fixed, numeral, isqrt, isqrt_fast, sqrtrem, bin_to_radix
label_desc: Use image node_id 59 for calling a global function with example usage: mpf_sqrt(s, prec, rnd) and returns: from_man_exp, s, normalize1