private void processReferenceInImportGuard(@NotNull PyElement node, @NotNull PyExceptPart guard) {
    final PyImportElement importElement = PsiTreeUtil.getParentOfType(node, PyImportElement.class);
    if (importElement != null) {
      final String visibleName = importElement.getVisibleName();
      final ScopeOwner owner = ScopeUtil.getScopeOwner(importElement);
      if (visibleName != null && owner != null) {
        final Collection<PsiElement> allWrites = ScopeUtil.getElementsOfAccessType(visibleName, owner, ReadWriteInstruction.ACCESS.WRITE);
        final boolean hasWriteInsideGuard = allWrites.stream().anyMatch(e -> PsiTreeUtil.isAncestor(guard, e, false));
        if (!hasWriteInsideGuard && !shouldSkipMissingWriteInsideGuard(guard, visibleName)) {
          myImportsInsideGuard.add(importElement);
        }
      }
    }
  }
private void processReferenceInImportGuard(@NotNull PyElement node, @NotNull PyExceptPart guard)