code: def get_end_trigger(options):
      """
      When to end the optimization based on input option.
      """
      if options.endTriggerType.lower() == "epoch":
          return MaxEpoch(options.endTriggerNum)
      else:
          return MaxIteration(options.endTriggerNum)
  
imports: from bigdl.dllib.feature.dataset import mnist
  from bigdl.dllib.feature.dataset.transformer import *
  from bigdl.dllib.optim.optimizer import *
label_desc: Use image node_id 3 for calling a global function with example usage: get_end_trigger(options) and returns: MaxEpoch, MaxIteration