code: public SafeStyle toSafeStyle() {
      Preconditions.checkState(
          getContentKind() == ContentKind.CSS,
          "toSafeStyle() only valid for SanitizedContent of kind CSS, is: %s",
          getContentKind());
  
      // Sanity check: Try to prevent accidental misuse when this is a full stylesheet rather than a
      // declaration list.
      // The error may trigger incorrectly if the content contains curly brackets inside comments or
      // quoted strings.
      //
      // This is a best-effort attempt to preserve SafeStyle's semantical guarantees.
      Preconditions.checkState(
          !getContent().contains("{"),
          "Calling toSafeStyle() with content that doesn't look like CSS declarations. "
              + "Consider using toSafeStyleSheet().");
  
      return UncheckedConversions.safeStyleFromStringKnownToSatisfyTypeContract(getContent());
    }
docs: Converts a Soy {@link SanitizedContent} of kind CSS into a {@link SafeStyle}.
  
  @throws IllegalStateException if this SanitizedContent's content kind is not {@link
  ContentKind#CSS}.