@Override
  public boolean tryToMove(@NotNull PsiElement element,
                           @NotNull Project project,
                           @Nullable DataContext dataContext,
                           @Nullable PsiReference reference,
                           @Nullable Editor editor) {
    final PsiFile currentFile = element.getContainingFile();
    if (editor != null && currentFile instanceof PyFile && selectionSpansMultipleLines(editor)) {
      final List<PyElement> moduleMembers = collectAllMovableElementsInSelection(editor, (PyFile)currentFile);
      if (moduleMembers.isEmpty()) {
        showBadSelectionErrorHint(project, editor);
      }
      else {
        doMove(project, moduleMembers);
      }
      return true;
    }

    // Fallback to the old way to select single element to move
    final PsiNamedElement e = PyMoveModuleMembersHelper.extractNamedElement(element);
    if (e != null && PyMoveModuleMembersHelper.hasMovableElementType(e)) {
      if (PyMoveModuleMembersHelper.isMovableModuleMember(e) || isMovableLocalFunctionOrMethod(e)) {
        doMove(project, Collections.singletonList((PyElement)e));
      }
      else {
        showBadSelectionErrorHint(project, editor);
      }
      return true;
    }
    return false;
  }
@Override
  public boolean tryToMove(@NotNull PsiElement element,
                           @NotNull Project project,
                           @Nullable DataContext dataContext,
                           @Nullable PsiReference reference,
                           @Nullable Editor editor)