Find a single element matching a predicate in a list.
This is a syntactic-sugar function _filter and expect_single in a single call.
Returns:
expect_single( _filter(lst, func), error_func )This is useful when we want to find an item in a sequence with a certain property, and expect there to be only one.
Examples:
>>> find_smith = lambda s: s.split()[-1] == 'Smith' >>> filter_expect_single( ['John Smith','Tim Jones'], func=find_smith ) 'John Smith'