public static @NotNull String escape(@NotNull CharSequence argument) {
    final StringBuilder builder = new StringBuilder(argument);
    StringUtil.escapeQuotes(builder);
    if (builder.length() == 0 || StringUtil.containsWhitespaces(builder) || StringUtil.indexOf(builder, '|') >= 0) {
      // don't let a trailing backslash (if any) unintentionally escape the closing quote
      int numTrailingBackslashes = builder.length() - StringUtil.trimTrailing(builder, '\\').length();
      StringUtil.quote(builder);
      StringUtil.repeatSymbol(builder, '\\', numTrailingBackslashes);
    }
    return builder.toString();
  }
public static @NotNull String escape(@NotNull CharSequence argument)