PyGlobalStatement (final PsiElement element) { final PsiElement parent = element.getParent(); if (parent instanceof PyGlobalStatement statement){ return ArrayUtil.find(statement.getGlobals(), element) != -1 ? statement : null; } return null; }