code: def _need_run(self):
      if self.local_step == self.trainer.steps_per_epoch - 1:
          return True
      if self._period > 0 and (self.local_step + 1) % self._period == 0:
          return True
      return False
  
imports: import numpy
  from collections import deque
  from ..compat import tfv1
  from ..tfutils.common import get_op_tensor_name
  from ..utils import logger
  from ..utils.naming import MOVING_SUMMARY_OPS_KEY
  from .base import Callback
label_desc: Use image node_id 3 for calling the MergeAllSummaries_RunWithOp obj's underlying member method code with example usage: obj._need_run() and returns: False, True, True