def METHOD_NAME(stream, ignore):
	for line in stream:
		# Remove newline
		line = line[0:-1]
		# Check if this line has a command
		match = command_re.match(line)
		if match:
			command = match.group(1)
			arg = match.group(3)
			if command in ("else", "elif", "endif"):
				return (command, arg)
			elif command not in commands:
				raise Exception("Unknown command: '%s'" % \
						command)
			# Get the callback function.
			func = commands[command]
			# Invoke the callback function. #ifdef commands
			# are a special case and need extra arguments.
			# Other commands are only executed if we are not
			# ignoring this block.
			if func == cmd_ifdef:
				cmd_ifdef(arg, command=command,
					       stream=stream,
					       ignore=ignore)
			elif not ignore:
				func(arg)
		else:
			if not ignore:
				for key, value in defines.items():
					if isinstance(value, str):
						line = line.replace(key, value)
				print(line)