Python Itertools Product Function Definition