## The Problem
James is a DJ at a local radio station. As it's getting to the top of the hour, he needs to find a song to play that will be short enough to fit in before the news block. He's got a database of songs that he'd like you to help him filter in order to do that.
## What To Do
Create `longestPossible`(`longest_possible` in python and ruby) helper function that takes 1 integer argument which is a maximum length of a song in seconds.
`songs` is an array of objects which are formatted as follows:
```python
{'artist': 'Artist', 'title': 'Title String', 'playback': '04:30'}
```
You can expect playback value to be formatted exactly like above.
Output should be a title of the longest song from the database that matches the criteria of not being longer than specified time. If there's no songs matching criteria in the database, return `false`.
from functools import reduce
songs = [{'artist': 'Marillion', 'title': 'Keyleigh', 'playback': '03:36'}, {'artist': 'Pink Floyd', 'title': 'Time', 'playback': '06:48'}, {'artist': 'Rush', 'title': 'YYZ', 'playback': '04:27'}, {'artist': 'Bonobo', 'title': 'Days To Come', 'playback': '03:50'}, {'artist': 'Coldplay', 'title': 'Yellow', 'playback': '04:32'}, {'artist': 'Bloc Party', 'title': 'Like Eating Glass', 'playback': '04:22'}, {'artist': 'The Killers', 'title': 'For Reasons Unknown', 'playback': '03:30'}, {'artist': 'Arctic Monkeys', 'title': 'Teddy Picker', 'playback': '03:25'}, {'artist': 'Joe Satriani', 'title': 'Surfing With The Alien', 'playback': '04:34'}]
def seconds(song):
    p = song.get('playback', 0)
    return int(p[:2]) * 60 + int(p[3:])
    
def pick_if(acc, x, playback):
    sx = seconds(x)
    return x if sx > seconds(acc) and sx <= playback else acc

def longest_possible(playback):
    r = reduce(lambda acc,x: pick_if(acc, x, playback), songs, {'title': False, 'playback': '00:00'})
    return r['title']
    

from functools import reduce
songs = [{'artist': 'Marillion', 'title': 'Keyleigh', 'playback': '03:36'}, {'artist': 'Pink Floyd', 'title': 'Time', 'playback': '06:48'}, {'artist': 'Rush', 'title': 'YYZ', 'playback': '04:27'}, {'artist': 'Bonobo', 'title': 'Days To Come', 'playback': '03:50'}, {'artist': 'Coldplay', 'title': 'Yellow', 'playback': '04:32'}, {'artist': 'Bloc Party', 'title': 'Like Eating Glass', 'playback': '04:22'}, {'artist': 'The Killers', 'title': 'For Reasons Unknown', 'playback': '03:30'}, {'artist': 'Arctic Monkeys', 'title': 'Teddy Picker', 'playback': '03:25'}, {'artist': 'Joe Satriani', 'title': 'Surfing With The Alien', 'playback': '04:34'}]
def seconds(song):
    p = song.get('playback', 0)
    return int(p[:2]) * 60 + int(p[3:])
    
def pick_if(acc, x, playback):
    sx = seconds(x)
    return x if sx > seconds(acc) and sx <= playback else acc

def longest_possible(playback):
    r = reduce(lambda acc,x: pick_if(acc, x, playback), songs, {'title': False, 'playback': '00:00'})
    return r['title']
    
