code: def mpi_from_str(s, prec):
      """
      Parse an interval number given as a string.
  
      Allowed forms are
  
      "-1.23e-27"
          Any single decimal floating-point literal.
      "a +- b"  or  "a (b)"
          a is the midpoint of the interval and b is the half-width
      "a +- b%"  or  "a (b%)"
          a is the midpoint of the interval and the half-width
          is b percent of a (`a \times b / 100`).
      "[a, b]"
          The interval indicated directly.
      "x[y,z]e"
          x are shared digits, y and z are unequal digits, e is the exponent.
  
      """
      e = ValueError("Improperly formed interval number '%s'" % s)
      s = s.replace(" ", "")
      wp = prec + 20
      if "+-" in s:
          x, y = s.split("+-")
          return mpi_from_str_a_b(x, y, False, prec)
      # case 2
      elif "(" in s:
          # Don't confuse with a complex number (x,y)
          if s[0] == "(" or ")" not in s:
              raise e
          s = s.replace(")", "")
          percent = False
          if "%" in s:
              if s[-1] != "%":
                  raise e
              percent = True
              s = s.replace("%", "")
          x, y = s.split("(")
          return mpi_from_str_a_b(x, y, percent, prec)
      elif "," in s:
          if ("[" not in s) or ("]" not in s):
              raise e
          if s[0] == "[":
              # case 3
              s = s.replace("[", "")
              s = s.replace("]", "")
              a, b = s.split(",")
              a = from_str(a, prec, round_floor)
              b = from_str(b, prec, round_ceiling)
              return a, b
          else:
              # case 4
              x, y = s.split("[")
              y, z = y.split(",")
              if "e" in s:
                  z, e = z.split("]")
              else:
                  z, e = z.rstrip("]"), ""
              a = from_str(x + y + e, prec, round_floor)
              b = from_str(x + z + e, prec, round_ceiling)
              return a, b
      else:
          a = from_str(s, prec, round_floor)
          b = from_str(s, prec, round_ceiling)
          return a, b
  
imports: from .backend import xrange
  from .libmpf import ComplexResult, round_down, round_up, round_floor, round_ceiling, round_nearest, prec_to_dps, repr_dps, dps_to_prec, bitcount, from_float, fnan, finf, fninf, fzero, fhalf, fone, fnone, mpf_sign, mpf_lt, mpf_le, mpf_gt, mpf_ge, mpf_eq, mpf_cmp, mpf_min_max, mpf_floor, from_int, to_int, to_str, from_str, mpf_abs, mpf_neg, mpf_pos, mpf_add, mpf_sub, mpf_mul, mpf_mul_int, mpf_div, mpf_shift, mpf_pow_int, from_man_exp, MPZ_ONE
  from .libelefun import mpf_log, mpf_exp, mpf_sqrt, mpf_atan, mpf_atan2, mpf_pi, mod_pi2, mpf_cos_sin
  from .gammazeta import mpf_gamma, mpf_rgamma, mpf_loggamma, mpc_loggamma
label_desc: Use image node_id 36 for calling a global function with example usage: mpi_from_str(s, prec) and returns: mpi_from_str_a_b, mpi_from_str_a_b, a,  b, a,  b, a,  b