def ipAdd(i, prefixLen=8, ipBaseNum=167772160):
 imax = (4294967295 >> prefixLen)
 assert (i <= imax), 'Not enough IP addresses in the subnet'
 mask = (4294967295 ^ imax)
 ipnum = ((ipBaseNum & mask) + i)
 return ipStr(ipnum)

def ipAdd ( i , prefixLen = 8 , ipBaseNum = 167772160 ) : imax = ( 4294967295 >> prefixLen ) assert ( i <= imax ) , 'Not enough IP addresses in the subnet' mask = ( 4294967295 ^ imax ) ipnum = ( ( ipBaseNum & mask ) + i ) return ipStr ( ipnum )
return ip address string from ints i: int to be added to ipbase prefixlen: optional ip prefix length ipbasenum: option base ip address as int returns ip address as string .