code: def _prepare_value(val, maxlen=50, notype=False):
      
      if val is None or val is True or val is False:
          return str(val)
      sval = repr(val)
      sval = sval.replace("\n", " ").replace("\t", " ").replace("`", "'")
      if len(sval) > maxlen:
          sval = sval[:maxlen - 4] + "..." + sval[-1]
      if notype:
          return sval
      else:
          tval = checker_for_type(type(val)).name()
          return "%s of type %s" % (sval, tval)
docs: Stringify value `val`, ensuring that it is not too long.