void (@NotNull final PyReferenceExpression element) { final PyExpression qualifier = element.getQualifier(); if (qualifier == null) return; if (qualifier instanceof PyCallExpression) { final PyExpression callee = ((PyCallExpression)qualifier).getCallee(); if (callee instanceof PyReferenceExpression) { final PyExpression calleeQualifier = ((PyReferenceExpression)callee).getQualifier(); if (calleeQualifier != null) { qualifier.replace(calleeQualifier); return; } } } final PsiElement dot = PyPsiUtils.getNextNonWhitespaceSibling(qualifier); if (dot != null) dot.delete(); qualifier.delete(); }