Create new value in data

def new_value(self, name, value):
        """Create new value in data"""
        try:
            # We need to enclose values in a list to be able to send
            # them to the kernel in Python 2
            svalue = [cloudpickle.dumps(value, protocol=PICKLE_PROTOCOL)]

            # Needed to prevent memory leaks. See issue 7158
            if len(svalue) < MAX_SERIALIZED_LENGHT:
                self.shellwidget.set_value(name, svalue)
            else:
                QMessageBox.warning(self, _("Warning"),
                                    _("The object you are trying to modify is "
                                      "too big to be sent back to the kernel. "
                                      "Therefore, your modifications won't "
                                      "take place."))
        except TypeError as e:
            QMessageBox.critical(self, _("Error"),
                                 "TypeError: %s" % to_text_string(e))
        self.shellwidget.refresh_namespacebrowser()