code: def write_key(self, name, value, comment=""):
          
  
          if value is None:
              self._FITS.write_undefined_key(self._ext+1,
                                             str(name),
                                             str(comment))
  
          elif isinstance(value, bool):
              if value:
                  v = 1
              else:
                  v = 0
              self._FITS.write_logical_key(self._ext+1,
                                           str(name),
                                           v,
                                           str(comment))
          elif isinstance(value, _stypes):
              self._FITS.write_string_key(self._ext+1,
                                          str(name),
                                          str(value),
                                          str(comment))
          elif isinstance(value, _ftypes):
              self._FITS.write_double_key(self._ext+1,
                                          str(name),
                                          float(value),
                                          str(comment))
          elif isinstance(value, _itypes):
              self._FITS.write_long_key(self._ext+1,
                                        str(name),
                                        int(value),
                                        str(comment))
          elif isinstance(value, (tuple, list)):
              vl = [str(el) for el in value]
              sval = ','.join(vl)
              self._FITS.write_string_key(self._ext+1,
                                          str(name),
                                          sval,
                                          str(comment))
          else:
              sval = str(value)
              mess = (
                  "warning, keyword '%s' has non-standard "
                  "value type %s, "
                  "Converting to string: '%s'")
              warnings.warn(mess % (name, type(value), sval), FITSRuntimeWarning)
              self._FITS.write_string_key(self._ext+1,
                                          str(name),
                                          sval,
                                          str(comment))
docs: Write the input value to the header
  
          parameters
          ----------
          name: string
              Name of keyword to write/update
          value: scalar
              Value to write, can be string float or integer type,
              including numpy scalar types.
          comment: string, optional
              An optional comment to write for this key
  
          Notes
          -----
          Write COMMENT and HISTORY using the write_comment and write_history
          methods