'Helper function that checks if there exists a loss with a given label at a certain
epoch index.  Depends on a LossCallback to have previously computed the loss and
stored in callback_data.  Does not actually do any computation.
Arguments:
callback_data (HDF5 dataset): shared data between callbacks
model (Model): model object
epoch (int): epoch index to check
label (str): label under which to find cached loss in callback_data
Returns:
dict containing loss cost value, timing information, and display information'

def _get_cached_epoch_loss(self, callback_data, model, epoch, label):

    if (self.costnm is None):
        self.costnm = 'Loss'
        if (model.cost and hasattr(model.cost, 'costfunc')):
            self.costnm = ((model.cost.costfunc.__class__.__name__ + '    ') + self.costnm)
    cost_key = ('cost/' + label)
    time_key = ('time/' + label)
    if (cost_key not in callback_data):
        return None
    eval_freq = callback_data[cost_key].attrs['epoch_freq']
    if (((epoch + 1) % eval_freq) == 0):
        return dict(cost=callback_data[cost_key][(epoch // eval_freq)], time=callback_data[time_key][(epoch // eval_freq)], costnm=self.costnm)
