@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
    if (!(file instanceof PyFile)) {
      return false;
    }
    final PsiElement element = PyUtil.findNonWhitespaceAtOffset(file, editor.getCaretModel().getOffset());
    final PyFunction function = PsiTreeUtil.getParentOfType(element, PyFunction.class);
    if (function == null) return false;
    final PyClass containingClass = function.getContainingClass();
    if (containingClass == null) return false;
    if (function.getParameterList().getParameters().length > 1) return false;

    final PyDecoratorList decoratorList = function.getDecoratorList();
    if (decoratorList != null) return false;

    final boolean[] available = {false};
    function.accept(new PyRecursiveElementVisitor() {
      @Override
      public void visitPyReturnStatement(@NotNull PyReturnStatement node) {
        if (node.getExpression() != null)
          available[0] = true;
      }

      @Override
      public void visitPyYieldExpression(@NotNull PyYieldExpression node) {
        available[0] = true;
      }
    });

    return available[0];
  }
@Override
  public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file)