code: def set_value(self, name, value):
          
          value = to_text_string(value)
          code = u"get_ipython().kernel.set_value('%s', %s, %s)" % (name, value,
                                                                    PY2)
  
          if self._reading:
              self.kernel_client.input(u'!' + code)
          else:
              self.silent_execute(code)
docs: Set value for a variable