'Called to implement evaluation of self[key].
>>> ip=IP(\'127.0.0.0/30\')
>>> for x in ip:
...  print(str(x))
127.0.0.0
127.0.0.1
127.0.0.2
127.0.0.3
>>> print(str(ip[2]))
127.0.0.2
>>> print(str(ip[-1]))
127.0.0.3'

def __getitem__(self, key):

    if isinstance(key, slice):
        return [IP(IPint.__getitem__(self, x), ipversion=self._ipversion) for x in xrange(*key.indices(len(self)))]
    return IP(IPint.__getitem__(self, key), ipversion=self._ipversion)
