def get_max_episode(num_h_layers, epoch_factor, penalty_every, **_):
    """Routine to calculate the total number of training episodes
    (1 episode = 1 penalty epoch + *penalty_every* normal epochs"""
    max_episode = (num_h_layers * epoch_factor) // penalty_every
    if max_episode == 0:
        raise ValueError('Penalty_every has to be smaller than the total number of epochs.')
    return max_episode