IFile workspaceFile = locator.getWorkspaceFile(file);
if (workspaceFile != null && workspaceFile.exists()) {
IProject project = workspaceFile.getProject();
if (project != null && project.exists()) {
PythonNature nature = PythonNature.getPythonNature(project);
String moduleName = nature.resolveModule(file);
if (moduleName != null) {
IModule mod = nature.getAstManager().getModule(moduleName, nature, true);
if (mod != null) {
ICompletionCache completionCache = new CompletionCache();
IDefinition[] definitions = mod.findDefinition(CompletionStateFactory