code: def margin_sampling(
      classifier: BaseEstimator,
      X: modALinput,
      n_instances: int = 1,
      random_tie_break: bool = False,
      **uncertainty_measure_kwargs,
  ) -> np.ndarray:
      """
      Margin sampling query strategy. Selects the instances where the difference between
      the first most likely and second most likely classes are the smallest.
      Args:
          classifier: The classifier for which the labels are to be queried.
          X: The pool of samples to query from.
          n_instances: Number of samples to be queried.
          random_tie_break: If True, shuffles utility scores to randomize the order. This
              can be used to break the tie when the highest utility score is not unique.
          **uncertainty_measure_kwargs: Keyword arguments to be passed for the uncertainty
              measure function.
      Returns:
          The indices of the instances from X chosen to be labelled.
          The margin metric of the chosen instances.
      """
      margin = classifier_margin(
          classifier, X, **uncertainty_measure_kwargs
      )
  
      if not random_tie_break:
          return multi_argmin(margin, n_instances=n_instances)
  
      return shuffled_argmin(margin, n_instances=n_instances)
  
file_path: modAL/modAL/uncertainty.py
imports: import numpy
  from scipy.stats import entropy
  from sklearn.base import BaseEstimator
  from sklearn.exceptions import NotFittedError
  from modAL.utils.data import modALinput
  from modAL.utils.selection import multi_argmax, multi_argmin, shuffled_argmax, shuffled_argmin
label_desc: Use image node_id 8 for calling a global function with example usage: margin_sampling(classifier, X, n_instances, random_tie_break) and returns: shuffled_argmin, multi_argmin