code: def _set_from_whole_string(rop, s, base, rnd):
      
      s = s.strip()
      ternary, endindex = mpfr.mpfr_strtofr(rop, s, base, rnd)
      if len(s) != endindex:
          raise ValueError("not a valid numeric string")
      return ternary
docs: Helper function for set_str2: accept a string, set rop, and return the
      appropriate ternary value.  Raise ValueError if ``s`` doesn't represent
      a valid string in the given base.