title: IP Range to CIDR conversion in Python?
body: <p>How can I get a CIDR notation representing a range of IP addresses, given the start and end IP addresses of the range, in Python? I can find CIDR to IP Range but cannot find any code for the reverse.</p>
  
  <p>Example of the desired output:</p>
  
  <pre><code>startip = '63.223.64.0'
  endip = '63.223.127.255'
  
  return '63.223.64.0/18'
  </code></pre>