title: Itertools.chain.from_iterable
body: <p>Can anyone explain to me, what exactly this code snippet is doing?</p>
  
  <pre><code>chained_country_list = set(itertools.chain.from_iterable(country_and_countrycodes)) &amp; set(all_countries)
  </code></pre>
  
  <p>I know it runs two lists against each other, ending up with a set of unique values, that exists in both the lists it compares.</p>
  
  <p>But how it does it, and whats happening under the hood, confuses me.</p>
  
  <p>Would be a huge help if someone could share some light on the issue.</p>