import re


def remove_comments( line ):
	"""Removes comments (which start with a '%' character) from a line.
	"""
	match_obj = re.match( "^(?P<non_comment>[^%]*)%.*$", line )
	if match_obj:
		return match_obj.group( "non_comment" )
	else:
		return line