String (@NotNull final PyElement element) { final String name = element.getName(); if (name != null) { final ScopeOwner owner = ScopeUtil.getScopeOwner(element); final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(element); if (owner instanceof PyClass) { final String classQName = ((PyClass)owner).getQualifiedName(); if (classQName != null) { return classQName + "." + name; } } else if (owner instanceof PyFile) { if (builtinCache.isBuiltin(element)) { return name; } else { final VirtualFile virtualFile = ((PyFile)owner).getVirtualFile(); if (virtualFile != null) { final String fileQName = findShortestImportableName(element, virtualFile); if (fileQName != null) { return fileQName + "." + name; } } } } } return null; }