code: def pack_ip(ipstr):
  	
  	if not isinstance(ipstr, basestring):
  		raise ValueError("given ip address is not a string")
  	parts = ipstr.split('.')
  	if len(parts) != 4:
  		raise ValueError("given ip address has an invalid number of dots")
  	parts = [int(x) for x in parts]  # raises ValueError
  	return int_seq_to_bytes(parts)
docs: Converts an ip address given in dotted notation to a four byte
  	string in network byte order.
  
  	>>> len(pack_ip("127.0.0.1"))
  	4
  	>>> pack_ip("foo")
  	Traceback (most recent call last):
  	...
  	ValueError: given ip address has an invalid number of dots
  
  	@type ipstr: str
  	@rtype: bytes
  	@raises ValueError: for badly formatted ip addresses