code: def sample(prob):
      """
      Sample index from probability distribution
      """
      prob = prob / (prob.sum() + 1e-6)
      return np.argmax(np.random.multinomial(1, prob, 1))
  
file_path: neon/examples/text_generation_lstm.py
imports: import numpy
  from neon import logger
  from neon.data import Shakespeare
  from neon.initializers import Uniform
  from neon.layers import GeneralizedCost, LSTM, Affine
  from neon.models import Model
  from neon.optimizers import RMSProp
  from neon.transforms import Logistic, Tanh, Softmax, CrossEntropyMulti
  from neon.callbacks.callbacks import Callbacks
  from neon.util.argparser import NeonArgparser
label_desc: Use image node_id 1 for calling a global function with example usage: sample(prob) and returns: np