code: def once_per_epoch(fcn):
      """Decorator to fire a callback once (on the first call) in any given epoch. If the callback is a class method, each
      instance of the class will fire once per epoch. For functions, only the first instance will fire (even if more than
      one function is present in the callback list).
  
      Example: ::
  
          >>> import torchbearer
          >>> from torchbearer import Trial
          >>> from torchbearer.callbacks import once_per_epoch, on_step_training
  
          # Example callback to be called exactly once per epoch, on the first training step
          >>> @once_per_epoch
          ... @on_step_training
          ... def print_callback(state):
          ...     print('This happens once per epoch')
  
          >>> trial = Trial(None, callbacks=[print_callback]).for_steps(1).run()
          This happens once per epoch
  
      .. note::
          The decorated callback may exhibit unusual behaviour if it is reused
  
      Args:
          fcn (function): the `torchbearer callback` function to decorate.
  
      Returns:
          the decorator
      """
  
      def ope(self, state):
          try:
              if state[torchbearer.EPOCH] != self.__last_epoch__:
                  self.__last_epoch__ = state[torchbearer.EPOCH]
                  return True
              return False
          except AttributeError:
              self.__last_epoch__ = state[torchbearer.EPOCH]
              return True
  
      return only_if(ope)(fcn)
  
imports: import sys
  import types
  import torchbearer
  from torchbearer.callbacks import Callback
label_desc: Use image node_id 23 for calling a global function with example usage: once_per_epoch(fcn) and returns: only_if, False, True, True