<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, string):
 		"""The write method for a CalcpkgOutput object- print the string"""

		if ("" == string or '\n' == string or '\r' == string):
			return
		
		# Filter out any \r newlines.
		string = string.replace("\r", "")
#		if '\r\n' in string:
#			string = util.replaceNewlines(string, '\r\n')
		
		if self.printData:
			print >> sys.__stdout__, string
		if self.logData:
			self.logWrite(string)