code: func CaptureStacktrace(th *starlark.Thread, skip int) (*CapturedStacktrace, error) {
  	f := th.Caller()
  	skipped := 0
  	for skipped < skip && f != nil {
  		f = f.Parent()
  		skipped++
  	}
  	if f == nil {
  		return nil, fmt.Errorf("stacktrace: the stack is not deep enough to skip %d levels, has only %d frames", skip, skipped)
  	}
  	buf := strings.Builder{}
  	f.WriteBacktrace(&buf)
  	return &CapturedStacktrace{buf.String()}, nil
  }
docs: // CaptureStacktrace captures thread's stack trace, skipping some number of
  // innermost frames.
  //
  // Returns an error if the stack is not deep enough to skip the requested number
  // of frames.