code: def sample(probabilities):
      probabilities = (
          probabilities.squeeze()
          if len(probabilities) > 1
          else probabilities
      )
      sample_onehot = np.random.multinomial(1, probabilities)
      return np.where(sample_onehot == 1)[0][0]
  
imports: import numpy
  import pandas
  import seaborn
  import matplotlib.pyplot
  import warnings
  import itertools
label_desc: Use image node_id 1 for calling a global function with example usage: sample(probabilities) and returns: np