title: List of IP addresses in Python to a list of CIDR
body: <p>How do I convert a list of IP addresses to a list of CIDRs?  <a href="http://code.google.com/p/ipaddr-py/" rel="noreferrer">Google's ipaddr-py library</a> has a method called summarize_address_range(first, last) that converts two IP addresses (start &amp; finish) to a CIDR list.  However, it cannot handle a list of IP addresses.</p>
  
  <pre><code>Example:
  &gt;&gt;&gt; list_of_ips = ['10.0.0.0', '10.0.0.1', '10.0.0.2', '10.0.0.3', '10.0.0.5']
  &gt;&gt;&gt; convert_to_cidr(list_of_ips)
  ['10.0.0.0/30','10.0.0.5/32']
  </code></pre>