'Appends a new keyword+value card to the end of the Header, similar
to `list.append`.
By default if the last cards in the Header have commentary keywords,
this will append the new keyword before the commentary (unless the new
keyword is also commentary).
Also differs from `list.append` in that it can be called with no
arguments: In this case a blank card is appended to the end of the
Header.  In the case all the keyword arguments are ignored.
Parameters
card : str, tuple
A keyword or a (keyword, value, [comment]) tuple representing a
single header card; the comment is optional in which case a
2-tuple may be used
useblanks : bool, optional
If there are blank cards at the end of the Header, replace the
first blank card so that the total number of cards in the Header
does not increase.  Otherwise preserve the number of blank cards.
bottom : bool, optional
If True, instead of appending after the last non-commentary card,
append after the last non-blank card.
end : bool, optional
If True, ignore the useblanks and bottom options, and append at the
very end of the Header.'

def append(self, card=None, useblanks=True, bottom=False, end=False):

    if isinstance(card, string_types):
        card = Card(card)
    elif isinstance(card, tuple):
        card = Card(*card)
    elif (card is None):
        card = Card()
    elif (not isinstance(card, Card)):
        raise ValueError('The    value    appended    to    a    Header    must    be    either    a    keyword    or    (keyword,    value,    [comment])    tuple;    got:    {!r}'.format(card))
    if ((not end) and card.is_blank):
        end = True
    if end:
        self._cards.append(card)
        idx = (len(self._cards) - 1)
    else:
        idx = (len(self._cards) - 1)
        while ((idx >= 0) and self._cards[idx].is_blank):
            idx -= 1
        if ((not bottom) and (card.keyword not in Card._commentary_keywords)):
            while ((idx >= 0) and (self._cards[idx].keyword in Card._commentary_keywords)):
                idx -= 1
        idx += 1
        self._cards.insert(idx, card)
        self._updateindices(idx)
    keyword = Card.normalize_keyword(card.keyword)
    self._keyword_indices[keyword].append(idx)
    if (card.field_specifier is not None):
        self._rvkc_indices[card.rawkeyword].append(idx)
    if (not end):
        if ((not bottom) and (card.keyword in Card._commentary_keywords)):
            self._keyword_indices[keyword].sort()
        if (useblanks and self._countblanks()):
            self._useblanks((len(str(card)) // Card.length))
    self._modified = True
