public static @Nullable String runExternalTool(final @NotNull Module module,
                                                 final @NotNull DocStringFormat format,
                                                 final @NotNull String input,
                                                 final @NotNull List<String> formatterFlags) {
    final Sdk sdk;
    final String missingInterpreterMessage;
    if (format == DocStringFormat.EPYTEXT) {
      sdk = PythonSdkType.findPython2Sdk(module);
      missingInterpreterMessage = PyPsiBundle.message("QDOC.epydoc.python2.sdk.not.found");
    }
    else {
      sdk = PythonSdkType.findLocalCPython(module);
      missingInterpreterMessage = PyPsiBundle.message("QDOC.local.sdk.not.found");
    }
    if (sdk == null) {
      LOG.warn("Python SDK for input formatter " + format + " is not found");
      return HtmlChunk.p().attr("color", ColorUtil.toHtmlColor(JBColor.RED)).addRaw(missingInterpreterMessage).toString();
    }

    final String sdkHome = sdk.getHomePath();
    if (sdkHome == null) return null;

    final ByteBuffer encoded = DEFAULT_CHARSET.encode(input);
    final byte[] data = new byte[encoded.limit()];
    encoded.get(data);

    final List<String> arguments = ContainerUtil.prepend(formatterFlags, "--format", format.getFormatterCommand());

    final GeneralCommandLine commandLine = PythonHelper.DOCSTRING_FORMATTER.newCommandLine(sdk, arguments);
    commandLine.setCharset(DEFAULT_CHARSET);

    LOG.debug("Command for launching docstring formatter: " + commandLine.getCommandLineString());

    final ProcessOutput output = PySdkUtil.getProcessOutput(commandLine, new File(sdkHome).getParent(), null, 5000, data, false);
    if (!output.checkSuccess(LOG)) {
      LOG.info("Malformed input:\n" + input);
      return null;
    }
    return output.getStdout();
  }
public static @Nullable String runExternalTool(final @NotNull Module module,
                                                 final @NotNull DocStringFormat format,
                                                 final @NotNull String input,
                                                 final @NotNull List<String> formatterFlags)