def first_ip(network):
 atoi = (lambda addr: struct.unpack('!I', socket.inet_aton(addr))[0])
 itoa = (lambda addr: socket.inet_ntoa(struct.pack('!I', addr)))
 (address, netmask) = network.split('/')
 netmask_i = ((4294967295 << (32 - atoi(netmask))) & 4294967295)
 return itoa(((atoi(address) & netmask_i) + 1))

def first_ip ( network ) : atoi = ( lambda addr : struct . unpack ( '!I' , socket . inet_aton ( addr ) ) [ 0 ] ) itoa = ( lambda addr : socket . inet_ntoa ( struct . pack ( '!I' , addr ) ) ) ( address , netmask ) = network . split ( '/' ) netmask_i = ( ( 4294967295 << ( 32 - atoi ( netmask ) ) ) & 4294967295 ) return itoa ( ( ( atoi ( address ) & netmask_i ) + 1 ) )
return the first ipv4 address in network args: network : network in cidr format returns: str: first ipv4 address .