>>>from itertools import product
>>> list(product('ABCD', 'xy'))
[('A', 'x'), ('A', 'y'), ('B', 'x'), ('B', 'y'), ('C', 'x'), ('C', 'y'), ('D', 'x'), ('D', 'y')]
>>>list(filter(lambda x: x[0] in ('A', 'B'), product('ABCD', 'xy')))
[('A', 'x'), ('A', 'y'), ('B', 'x'), ('B', 'y')]