def keep_episodes(show, keep):
deleted = <NUM_LIT:0><EOL>print('<STR_LIT>' % (datestr(), show.title, keep))<EOL>sort = lambda x:x.originallyAvailableAt or x.addedAt<EOL>items = sorted(show.episodes(), key=sort, reverse=True)<EOL>for episode in items[keep:]:<EOL><INDENT>delete_episode(episode)<EOL>deleted += <NUM_LIT:1><EOL><DEDENT>return deleted<EOL>
Delete all but last count episodes in show.