#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1242
Task: \
</think>

Write a Python function that takes a list of dictionaries representing episodes and returns the episode with the highest emotional peak value.
Generated: 2026-02-13T01:30:55.769042
"""

def find_episode_with_highest_peak(episodes):
    highest_peak = -float('inf')
    best_episode = None
    for episode in episodes:
        if 'emotional_peak' in episode:
            if episode['emotional_peak'] > highest_peak:
                highest_peak = episode['emotional_peak']
                best_episode = episode
    return best_episode


if __name__ == '__main__':
    episodes = [
        {'title': 'Episode 1', 'emotional_peak': 7.5},
        {'title': 'Episode 2', 'emotional_peak': 8.2},
        {'title': 'Episode 3', 'emotional_peak': 6.9},
        {'title': 'Episode 4', 'emotional_peak': 9.1},
        {'title': 'Episode 5', 'emotional_peak': 7.8}
    ]
    result = find_episode_with_highest_peak(episodes)
    print(f"Episode with highest emotional peak: {result['title']}, Peak: {result['emotional_peak']}")