code: def generator_from_neighbour_matrix(
      X, Y, neighbour_matrix, batch_size
  ):
      if Y is None:
          return UnsupervisedTripletGenerator(
              X, neighbour_matrix, batch_size=batch_size
          )
  
      return SupervisedTripletGenerator(
          X, Y, neighbour_matrix, batch_size=batch_size
      )
  
imports: from abc import ABC, abstractmethod
  from functools import partial
  import itertools
  import random
  import math
  import numpy
  from tensorflow.keras.utils import Sequence
  from scipy.sparse import issparse
  from ..data import get_uint_ctype
label_desc: Use image node_id 1 for calling a global function with example usage: generator_from_neighbour_matrix(X, Y, neighbour_matrix, batch_size) and returns: SupervisedTripletGenerator, UnsupervisedTripletGenerator