def write_keys(self, records_in, clean=True):
if isinstance(records_in, FITSHDR):<EOL><INDENT>hdr = records_in<EOL><DEDENT>else:<EOL><INDENT>hdr = FITSHDR(records_in)<EOL><DEDENT>if clean:<EOL><INDENT>is_table = hasattr(self, '<STR_LIT>')<EOL>hdr.clean(is_table=is_table)<EOL><DEDENT>for r in hdr.records():<EOL><INDENT>name = r['<STR_LIT:name>'].upper()<EOL>value = r['<STR_LIT:value>']<EOL>if name == '<STR_LIT>':<EOL><INDENT>self.write_comment(value)<EOL><DEDENT>elif name == '<STR_LIT>':<EOL><INDENT>self.write_history(value)<EOL><DEDENT>elif name == '<STR_LIT>':<EOL><INDENT>self._write_continue(value)<EOL><DEDENT>else:<EOL><INDENT>comment = r.get('<STR_LIT>', '<STR_LIT>')<EOL>self.write_key(name, value, comment=comment)<EOL><DEDENT><DEDENT>
Write the keywords to the header.

parameters
----------
records: FITSHDR or list or dict
    Can be one of these:
        - FITSHDR object
        - list of dictionaries containing 'name','value' and optionally
          a 'comment' field; the order is preserved.
        - a dictionary of keyword-value pairs; no comments are written
          in this case, and the order is arbitrary.
clean: boolean
    If True, trim out the standard fits header keywords that are
    created on HDU creation, such as EXTEND, SIMPLE, STTYPE, TFORM,
    TDIM, XTENSION, BITPIX, NAXIS, etc.

Notes
-----
Input keys named COMMENT and HISTORY are written using the
write_comment and write_history methods.