def show_episodes(series, start=None, stop=None, count=False, descending=False, session=None):
 episodes = session.query(Episode).filter((Episode.series_id == series.id))
 if count:
  return episodes.count()
 if (series.identified_by == u'sequence'):
  episodes = (episodes.order_by(Episode.number.desc()) if descending else episodes.order_by(Episode.number))
 elif (series.identified_by == u'ep'):
  episodes = (episodes.order_by(Episode.season.desc(), Episode.number.desc()) if descending else episodes.order_by(Episode.season, Episode.number))
 else:
  episodes = (episodes.order_by(Episode.identifier.desc()) if descending else episodes.order_by(Episode.identifier))
 return episodes.slice(start, stop).from_self().all()

def show_episodes ( series , start = None , stop = None , count = False , descending = False , session = None ) : episodes = session . query ( Episode ) . filter ( ( Episode . series_id == series . id ) ) if count : return episodes . count ( ) if ( series . identified_by == u'sequence' ) : episodes = ( episodes . order_by ( Episode . number . desc ( ) ) if descending else episodes . order_by ( Episode . number ) ) elif ( series . identified_by == u'ep' ) : episodes = ( episodes . order_by ( Episode . season . desc ( ) , Episode . number . desc ( ) ) if descending else episodes . order_by ( Episode . season , Episode . number ) ) else : episodes = ( episodes . order_by ( Episode . identifier . desc ( ) ) if descending else episodes . order_by ( Episode . identifier ) ) return episodes . slice ( start , stop ) . from_self ( ) . all ( )
return all episodes of a given series .