'Return a string representation as a binary value.
>>> print IP(\'127.0.0.1\').strBin()
01111111000000000000000000000001'

def strBin(self, wantprefixlen=None):

    if (self._ipversion == 4):
        bits = 32
    elif (self._ipversion == 6):
        bits = 128
    else:
        raise ValueError('only    IPv4    and    IPv6    supported')
    if ((self.WantPrefixLen is None) and (wantprefixlen is None)):
        wantprefixlen = 0
    ret = _intToBin(self.ip)
    return ((('0' * (bits - len(ret))) + ret) + self._printPrefix(wantprefixlen))
