def increment_ipv4_segments(segments):
 segments = [int(segment) for segment in segments]
 segments[3] += 1
 if (segments[3] == 256):
  segments[3] = 0
  segments[2] += 1
  if (segments[2] == 256):
   segments[2] = 0
   segments[1] += 1
   if (segments[1] == 256):
    segments[1] = 0
    segments[0] += 1
 return segments

def increment_ipv4_segments ( segments ) : segments = [ int ( segment ) for segment in segments ] segments [ 3 ] += 1 if ( segments [ 3 ] == 256 ) : segments [ 3 ] = 0 segments [ 2 ] += 1 if ( segments [ 2 ] == 256 ) : segments [ 2 ] = 0 segments [ 1 ] += 1 if ( segments [ 1 ] == 256 ) : segments [ 1 ] = 0 segments [ 0 ] += 1 return segments
increment an ip address given in quad segments based on ipv4 rules .