<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_html5_canvas_format(self, fmt):
 """ Sets the format used for rendering to the HTML5 canvas. 'png' offers greater clarity, especially for small text, but does not have as good of performance as 'jpeg'. """

        fmt = fmt.lower()
        if fmt not in ('jpeg', 'png'):
            raise ValueError("Format must be one of {jpeg|png} not '%s'" % (
                fmt))

        settings = self.get_settings()
        settings.set(html5_canvas_format=fmt)