<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pack_ip(ipstr):
 	"""Converts an ip address given in dotted notation to a four byte 	string in network byte order. 	4 	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 	"""

	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)