public static @Nullable PsiNamedElement extractNamedElement(@NotNull PsiElement element) {
    if (element instanceof PyClass || element instanceof PyFunction || element instanceof PyTargetExpression) {
      return (PsiNamedElement)element;
    }
    final PyAssignmentStatement assignment = as(element, PyAssignmentStatement.class);
    if (assignment != null) {
      return as(assignment.getTargets()[0], PyTargetExpression.class);
    }
    return null;
  }
public static @Nullable PsiNamedElement extractNamedElement(@NotNull PsiElement element)