code: def _iter_msg_generator(count_generator, phase):
      """
      Generate a numbered sequence of IterationMessage objects
      with phase-appropriate signals.
      count_generator is an iterable object yielding iteration numbers
      phase is one of TRAIN, VALID or INFER
      """
      for iter_i in count_generator:
          iter_msg = IterationMessage()
          iter_msg.current_iter, iter_msg.phase = iter_i, phase
          yield iter_msg
  
imports: import itertools
  import time
  from niftynet.engine.application_variables import CONSOLE, TF_SUMMARIES
  from niftynet.engine.signal import TRAIN, VALID, INFER
  from niftynet.utilities.util_common import look_up_operations
label_desc: Use image node_id 3 for calling a global function with example usage: _iter_msg_generator(count_generator, phase) without return types