title: itertools combinations and products
body: <p>I am trying to understand the itertools library and my data looks like this.</p>
  <pre><code>devices = ['devicea', 'deviceb', 'devicec']
  data = {'devicea': [{'ip': '192.168.1.1', 'vrf': 'aaa'}, {'ip': '192.168.1.2', 'vrf': 'aaa'}],
          'deviceb': [{'ip': '10.1.1.1', 'vrf': 'bbb'}, {'ip': '10.1.1.2', 'vrf': 'bbb'}],
          'devicec': [{'ip': '20.1.1.1', 'vrf': 'ccc'}, {'ip': '20.1.1.2', 'vrf': 'ccc'}]}
  </code></pre>
  <p>I would like to get the products of the ip of the combinations of the devices, e.g the result should look like this.</p>
  <pre><code>[(192.168.1.1, 10.1.1.1), (192.168.1.1, 10.1.1.2), (192.168.1.1, 20.1.1.1), 192.168.1.1, 20.1.1.2), (192.168.1.2, 10.1.1.1), (192.168.1.2, 10.1.1.2), (192.168.1.2, 20.1.1.1), (192.168.1.2, 20.1.1.2), (10.1.1.1, 20.1.1.1), (10.1.1.1, 20.1.1.2), (10.1.1.2, 20.1.1.1), (10.1.1.2, 20.1.1.2)]
  </code></pre>
  <p>using itertools.combinations I can get the pair of the possible combination of the devices.</p>
  <pre><code>device_combination = itertools.combinations(devices, 2)
  </code></pre>
  <p>How can I use itertools.products to find the products of the ip addresses?</p>