<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_contents(self, origin):
 """ Try to load the origin. """

        try:
            path = self.get_app_template_path(
                origin.app_name, origin.template_name)
            with io.open(path, encoding=self.engine.file_charset) as fp:
                return fp.read()
        except KeyError:
            raise TemplateDoesNotExist(origin)
        except IOError as error:
            if error.errno == errno.ENOENT:
                raise TemplateDoesNotExist(origin)
            raise