def _check_has_scope_info(self) -> None:
        """
        Check no ops in the function are missing scope information.
        """

        def _check_has_scope_info_block(block: Block):
            for op in block.operations:
                for b in op.blocks:
                    _check_has_scope_info_block(b)
                for scope in self._essential_scope_sources:
                    if scope not in op.scopes or len(op.scopes[scope]) == 0:
                        raise ValueError(
                            f"op {op.name} with scopes {op.scopes} is missing essential scopes {scope}."
                        )

        _check_has_scope_info_block(self)

        Check no ops in the function are missing scope information.
        
coremltools/converters/mil/mil/block.py