docs: def rustcall(func, *args):
      """Calls rust method and does some error handling."""
      lib.semaphore_err_clear()
      rv = func(*args)
      err = lib.semaphore_err_get_last_code()
      if not err:
          return rv
      msg = lib.semaphore_err_get_last_message()
      cls = exceptions_by_code.get(err, SemaphoreError)
      exc = cls(decode_str(msg))
      backtrace = decode_str(lib.semaphore_err_get_backtrace())
      if backtrace:
          exc.rust_info = backtrace
      raise exc