'Rename a card\'s keyword in the header.
Parameters
oldkeyword : str or int
Old keyword or card index
newkeyword : str
New keyword
force : bool, optional
When `True`, if the new keyword already exists in the header, force
the creation of a duplicate keyword. Otherwise a
`ValueError` is raised.'

def rename_keyword(self, oldkeyword, newkeyword, force=False):

    oldkeyword = Card.normalize_keyword(oldkeyword)
    newkeyword = Card.normalize_keyword(newkeyword)
    if (newkeyword == 'CONTINUE'):
        raise ValueError('Can    not    rename    to    CONTINUE')
    if ((newkeyword in Card._commentary_keywords) or (oldkeyword in Card._commentary_keywords)):
        if (not ((newkeyword in Card._commentary_keywords) and (oldkeyword in Card._commentary_keywords))):
            raise ValueError('Regular    and    commentary    keys    can    not    be    renamed    to    each    other.')
    elif ((not force) and (newkeyword in self)):
        raise ValueError('Intended    keyword    {}    already    exists    in    header.'.format(newkeyword))
    idx = self.index(oldkeyword)
    card = self.cards[idx]
    del self[idx]
    self.insert(idx, (newkeyword, card.value, card.comment))
