code: def on_episode_end(self, episode, logs={}):
          
          for callback in self.callbacks:
              # Check if callback supports the more appropriate `on_episode_end` callback.
              # If not, fall back to `on_epoch_end` to be compatible with built-in Keras callbacks.
              if callable(getattr(callback, 'on_episode_end', None)):
                  callback.on_episode_end(episode, logs=logs)
              else:
                  callback.on_epoch_end(episode, logs=logs)
docs: Called at end of each episode for each callback in callbackList