code: def weak_labels_from_guide(monkeypatch, resources):
      matrix_and_annotation = np.load(
          str(resources / "weak-supervision-guide-matrix.npy")
      )
      matrix, annotation = (
          matrix_and_annotation[:, :-1],
          matrix_and_annotation[:, -1],
      )
  
      def mock_load(*args, **kwargs):
          return [
              TextClassificationRecord(text="mock", id=i)
              for i in range(len(matrix))
          ]
  
      monkeypatch.setattr(
          "argilla.labeling.text_classification.weak_labels.load",
          mock_load,
      )
  
      def mock_apply(self, *args, **kwargs):
          return matrix, annotation, {None: -1, "SPAM": 0, "HAM": 1}
  
      monkeypatch.setattr(WeakLabels, "_apply_rules", mock_apply)
  
      return WeakLabels(
          rules=[lambda x: "mock"] * matrix.shape[1], dataset="mock"
      )
  
imports: import sys
  import numpy
  import pytest
  from argilla.client.models import TextClassificationRecord
  from argilla.labeling.text_classification import FlyingSquid, Snorkel, WeakLabels, WeakMultiLabels
  from argilla.labeling.text_classification.label_models import LabelModel, MajorityVoter, MissingAnnotationError, NotFittedError, TieBreakPolicy, TooFewRulesError
label_desc: Use image node_id 2 for calling a global function with example usage: weak_labels_from_guide(monkeypatch, resources) and returns: WeakLabels, unknown, matrix,  annotation,  dict