def write_key(self, name, value, comment="<STR_LIT>"):
if value is None:<EOL><INDENT>self._FITS.write_undefined_key(self._ext+<NUM_LIT:1>,<EOL>str(name),<EOL>str(comment))<EOL><DEDENT>elif isinstance(value, bool):<EOL><INDENT>if value:<EOL><INDENT>v = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>v = <NUM_LIT:0><EOL><DEDENT>self._FITS.write_logical_key(self._ext+<NUM_LIT:1>,<EOL>str(name),<EOL>v,<EOL>str(comment))<EOL><DEDENT>elif isinstance(value, _stypes):<EOL><INDENT>self._FITS.write_string_key(self._ext+<NUM_LIT:1>,<EOL>str(name),<EOL>str(value),<EOL>str(comment))<EOL><DEDENT>elif isinstance(value, _ftypes):<EOL><INDENT>self._FITS.write_double_key(self._ext+<NUM_LIT:1>,<EOL>str(name),<EOL>float(value),<EOL>str(comment))<EOL><DEDENT>elif isinstance(value, _itypes):<EOL><INDENT>self._FITS.write_long_key(self._ext+<NUM_LIT:1>,<EOL>str(name),<EOL>int(value),<EOL>str(comment))<EOL><DEDENT>elif isinstance(value, (tuple, list)):<EOL><INDENT>vl = [str(el) for el in value]<EOL>sval = '<STR_LIT:U+002C>'.join(vl)<EOL>self._FITS.write_string_key(self._ext+<NUM_LIT:1>,<EOL>str(name),<EOL>sval,<EOL>str(comment))<EOL><DEDENT>else:<EOL><INDENT>sval = str(value)<EOL>mess = (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>warnings.warn(mess % (name, type(value), sval), FITSRuntimeWarning)<EOL>self._FITS.write_string_key(self._ext+<NUM_LIT:1>,<EOL>str(name),<EOL>sval,<EOL>str(comment))<EOL><DEDENT>
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