code: def checkForSpiceError(f):
      
      if failed():
          errorparts = {
              "tkvsn": tkvrsn("TOOLKIT").replace("CSPICE_", ""),
              "short": getmsg("SHORT", 26),
              "explain": getmsg("EXPLAIN", 100).strip(),
              "long": getmsg("LONG", 321).strip(),
              "traceback": qcktrc(200)}
          msg = stypes.errorformat.format(**errorparts)
          reset()
          raise stypes.SpiceyError(msg)
docs: Internal function to check
      :param f:
      :raise stypes.SpiceyError: