def to_internal_value(self, data):
        # If data is a string, try to base64-decode it.
        if isinstance(data, str):
            if 'data:' in data and ';base64,' in data:
                header, data = data.split(';base64,')

            try:
                decoded_data = base64.b64decode(data)
            except __HOLE__:
                self.fail('invalid_image')

            file_name = 'uploaded_image.' + self.guess_file_extension(decoded_data)

            data = ContentFile(decoded_data, name=file_name)

        return super().to_internal_value(data)
dataset/ETHPy150Open jsmesami/naovoce/src/gallery/api/serializers.py/Base64ImageField.to_internal_value