<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def toGIF(self, **attribs):
 """ Convert canvas to GIF bytes """

        im = self.toPIL(**attribs)
        sfile = io.BytesIO()
        im.save(sfile, format="gif")
        return sfile.getvalue()