def _ip(src, dst, payload):
 ipHeader = ((((('E\x00' + _H((20 + len(payload)))) + '\x00\x01\x00\x00@\x11') + _H(0)) + socket.inet_pton(socket.AF_INET, nativeString(src))) + socket.inet_pton(socket.AF_INET, nativeString(dst)))
 checksumStep1 = sum(struct.unpack('!10H', ipHeader))
 carry = (checksumStep1 >> 16)
 checksumStep2 = ((checksumStep1 & 65535) + carry)
 checksumStep3 = (checksumStep2 ^ 65535)
 ipHeader = ((ipHeader[:10] + struct.pack('!H', checksumStep3)) + ipHeader[12:])
 return (ipHeader + payload)

def _ip ( src , dst , payload ) : ipHeader = ( ( ( ( ( 'E\x00' + _H ( ( 20 + len ( payload ) ) ) ) + '\x00\x01\x00\x00@\x11' ) + _H ( 0 ) ) + socket . inet_pton ( socket . AF_INET , nativeString ( src ) ) ) + socket . inet_pton ( socket . AF_INET , nativeString ( dst ) ) ) checksumStep1 = sum ( struct . unpack ( '!10H' , ipHeader ) ) carry = ( checksumStep1 >> 16 ) checksumStep2 = ( ( checksumStep1 & 65535 ) + carry ) checksumStep3 = ( checksumStep2 ^ 65535 ) ipHeader = ( ( ipHeader [ : 10 ] + struct . pack ( '!H' , checksumStep3 ) ) + ipHeader [ 12 : ] ) return ( ipHeader + payload )
construct an ip datagram with the given source .