<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def match_string(self, string_to_match, regexp):
 		"""Get regular expression from the first of the lines passed 		in in string that matched. Handles first group of regexp as 		a return value. 		@param string_to_match: String to match on 		@param regexp: Regexp to check (per-line) against string 		@type string_to_match: string 		@type regexp: string 		Returns None if none of the lines matched. 		Returns True if there are no groups selected in the regexp. 		else returns matching group (ie non-None) 		"""

		shutit_global.shutit_global_object.yield_to_draw()
		if not isinstance(string_to_match, str):
			return None
		lines = string_to_match.split('\r\n')
		# sometimes they're separated by just a carriage return...
		new_lines = []
		for line in lines:
			new_lines = new_lines + line.split('\r')
		# and sometimes they're separated by just a newline...
		for line in lines:
			new_lines = new_lines + line.split('\n')
		lines = new_lines
		if not shutit_util.check_regexp(regexp):
			self.fail('Illegal regexp found in match_string call: ' + regexp) # pragma: no cover
		for line in lines:
			match = re.match(regexp, line)
			if match is not None:
				if match.groups():
					return match.group(1)
				return True
		return None