To use this package in your project, you can do one of the following:

>>> from adytum.netcidr import network
>>> network.CIDR(172.16.4.28/27')
172.16.4.28/27

Or, if you have other adytum eggs installed (such as PyRRD, PyFlowCatch,
CoyoteMonitiring, etc.), you can use the other alternative:

>>> from pkg_resources import require
>>> require('Adytum-NetCIDR')
>>> from adytum.netcidr import network
>>> network.CIDR(172.16.4.28/27')
172.16.4.28/27

There are extensive doctests in the library -- please look at those for
many, many examples of usage.

For convenience, a few small examples are presented below:

* create CIDR addresses for hosts and net blocks:
    >>> CIDR('10.4.1.2')
    10.4.1.2
    >>> CIDR('10.4.1.x')
    10.4.1.0/24
    >>> CIDR('10.*.*.*')
    10.0.0.0/8
    >>> c = CIDR('172.16.4.28/27')
    >>> c
    172.16.4.28/27
    >>> c.getHostCount()
    32

* get ranges of addresses for net blocks:
    >>> CIDR('172.16.4.27/31').getHostRange()
    (172.16.4.26, 172.16.4.27)
    >>> CIDR('172.16.4.27/21').getHostRange()
    (172.16.0.0, 172.16.7.255)
    >>> CIDR('172.16.4.27/3').getHostRange()
    (160.0.0.0, 191.255.255.255)

* create collections of networks:

    >>> net_cidr = CIDR('192.168.4.0/24')
    >>> corp_cidr = CIDR('10.5.0.0/16')
    >>> vpn_cidr = CIDR('172.16.9.5/27')
    >>> mynets = Networks([net_cidr, corp_cidr, vpn_cidr])

* determine if a CIDR address is in a given network or set of networks:

    >>> home_router = CIDR('192.168.4.1')
    >>> laptop1 = CIDR('192.168.4.100')
    >>> webserver = CIDR('10.5.10.10')
    >>> laptop2 = CIDR('172.16.9.17')
    >>> google = CIDR('64.233.187.99')
    >>> home_router in mynets
    True
    >>> laptop1 in mynets
    True
    >>> webserver in mynets
    True
    >>> laptop2 in mynets
    True
    >>> google in mynets
    False

