<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_page(self, path, template, **kwargs):
 		""" 		Generate the HTML for a single page. You usually don't need to call this 		method manually, it is used by a lot of other, more end-user friendly 		methods. 		Args: 		 path (str):
 Where to place the page relative to the root URL. Usually 		 something like "index", "about-me", "projects/example", etc. 		 template (str):
 Which jinja template to use to render the page. 		 **kwargs: Kwargs will be passed on to the jinja template. Also, if 		 the `page` kwarg is passed, its directory attribute will be 		 prepended to the path. 		"""

		directory = None
		if kwargs.get('page'):
			directory = kwargs['page'].dir

		path = self._get_dist_path(path, directory=directory)
		if not path.endswith('.html'):
			path = path + '.html'

		if not os.path.isdir(os.path.dirname(path)):
			os.makedirs(os.path.dirname(path))

		html = self._get_template(template).render(**kwargs)

		with open(path, 'w+') as file:
			file.write(html)