Taken from scapy v1 requiring python 2.3 ported to python 2.6