def split_data(msg, expected_fields):
	"""
	Helper method. gets a string and number of expected fields in it. Splits the string 
	using protocol's data field delimiter (|#) and validates that there are correct number of fields.
	Returns: list of fields if all ok. If some error occured, returns None
	"""
	count=0
	List=[]
	temp_str=""
	for x in msg:
		
		if x=="#":
			count+=1
			List.append(temp_str)
			temp_str=""
		else:
			temp_str=temp_str+x

	if count==expected_fields:
		List.append(temp_str)
		return List
	else:
		return [None]