1
2
3
4
5
6 """Helper functions for handling lists"""
7
8
10 """
11 Return the first element in values that is also in matches.
12
13 Return None if values is None, empty or no element in values is also in
14 matches.
15
16 @type values: collections.abc.Iterable
17 @param values: list of items to look through, can be None
18 @type matches: collections.abc.Container
19 @param matches: list of items to check against
20 """
21 assert matches is not None
22 if not values:
23 return None
24 return next((i for i in values if i in matches), None)
25