code: def generate(self, chars, format='png'):
          
          im = self.generate_image(chars)
          out = BytesIO()
          im.save(out, format=format)
          out.seek(0)
          return out
docs: Generate an Image Captcha of the given characters.
  
          :param chars: text to be generated.
          :param format: image file format