public static void annotateTypes(Editor editor, PyFunction function) {
    if (!FileModificationService.getInstance().preparePsiElementForWrite(function)) return;

    WriteAction.run(() -> {
      if (isPy3k(function.getContainingFile())) {
        generatePy3kTypeAnnotations(function.getProject(), editor, function);
      }
      else {
        generateTypeCommentAnnotations(function.getProject(), function);
      }
    });
  }
public static void annotateTypes(Editor editor, PyFunction function)