def insert_header(self, hkey, value, index=None):
<EOL>if type(hkey) in [int, int]: hkey = self.hkeys[hkey]<EOL>self.headers[str(hkey)] = value<EOL>if not hkey in self.hkeys:<EOL><INDENT>if index is None: self.hkeys.append(str(hkey))<EOL>else:             self.hkeys.insert(index, str(hkey))<EOL><DEDENT>return self<EOL>
This will insert/overwrite a value to the header and hkeys.

Parameters
----------
hkey
    Header key. Will be appended to self.hkeys if non existent, or 
    inserted at the specified index. 
    If hkey is an integer, uses self.hkeys[hkey].
value
    Value of the header.
index=None
    If specified (integer), hkey will be inserted at this location in 
    self.hkeys.