<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def data_url(self, image_format='png', add_quiet_zone=True):
 """Get a data URL representing the barcode. :param image_format: Either 'png' or 'bmp'. :param add_quiet_zone: Add a 10 white pixels on either side of the barcode. :raises: Code128.UnknownFormatError :raises: Code128.MissingDependencyError :rtype: str :returns: A data URL with the barcode as an image. """

        memory_file = io.BytesIO()
        pil_image = self.image(add_quiet_zone=add_quiet_zone)

        # Using BMP can often result in smaller data URLs than PNG, but it isn't as widely supported by browsers as PNG.
        # GIFs result in data URLs 10 times bigger than PNG or BMP, possibly due to lack of support for monochrome GIFs
        # in Pillow, so they shouldn't be used.
        if image_format == 'png':
            # Unfortunately there is no way to avoid adding the zlib headers.
            # Using compress_level=0 sometimes results in a slightly bigger data size (by a few bytes), but there
            # doesn't appear to be a difference between levels 9 and 1, so let's just use 1.
            pil_image.save(memory_file, format='png', compress_level=1)
        elif image_format == 'bmp':
            pil_image.save(memory_file, format='bmp')
        else:
            raise Code128.UnknownFormatError('Only png and bmp are supported.')

        # Encode the data in the BytesIO object and convert the result into unicode.
        base64_image = base64.b64encode(memory_file.getvalue()).decode('ascii')

        data_url = 'data:image/{format};base64,{base64_data}'.format(
            format=image_format,
            base64_data=base64_image
        )

        return data_url