code: @Override
    public IdType withVersion(String theVersion) {
      if (isBlank(theVersion)) {
        return toVersionless();
      }
  
      if (isLocal() || isUrn()) {
        return new IdType(getValueAsString());
      }
  
      String existingValue = getValue();
  
      int i = existingValue.indexOf("_history");
      String value;
      if (i > 1) {
        value = existingValue.substring(0, i - 1);
      } else {
        value = existingValue;
      }
  
      return new IdType(value + '/' + "_history" + '/' + theVersion);
    }
docs: Creates a new instance of this ID which is identical, but refers to the
  specific version of this resource ID noted by theVersion.
  
  @param theVersion The actual version string, e.g. "1". If theVersion is blank or null, returns the same as {@link #toVersionless()}}
  @return A new instance of IdType which is identical, but refers to the
  specific version of this resource ID noted by theVersion.