'Check the existence, location, and value of a required `Card`.
Parameters
keyword : str
The keyword to validate
pos : int, callable
If an ``int``, this specifies the exact location this card should
have in the header.  Remember that Python is zero-indexed, so this
means ``pos=0`` requires the card to be the first card in the
header.  If given a callable, it should take one argument--the
actual position of the keyword--and return `True` or `False`.  This
can be used for custom evaluation.  For example if
``pos=lambda idx: idx > 10`` this will check that the keyword\'s
index is greater than 10.
test : callable
This should be a callable (generally a function) that is passed the
value of the given keyword and returns `True` or `False`.  This can
be used to validate the value associated with the given keyword.
fix_value : str, int, float, complex, bool, None
A valid value for a FITS keyword to to use if the given ``test``
fails to replace an invalid value.  In other words, this provides
a default value to use as a replacement if the keyword\'s current
value is invalid.  If `None`, there is no replacement value and the
keyword is unfixable.
option : str
Output verification option.  Must be one of ``"fix"``,
``"silentfix"``, ``"ignore"``, ``"warn"``, or
``"exception"``.  May also be any combination of ``"fix"`` or
``"silentfix"`` with ``"+ignore"``, ``+warn``, or ``+exception"
(e.g. ``"fix+warn"``).  See :ref:`verify` for more info.
errlist : list
A list of validation errors already found in the FITS file; this is
used primarily for the validation system to collect errors across
multiple HDUs and multiple calls to `req_cards`.
Notes
If ``pos=None``, the card can be anywhere in the header.  If the card
does not exist, the new card will have the ``fix_value`` as its value
when created.  Also check the card\'s value by using the ``test``
argument.'

def req_cards(self, keyword, pos, test, fix_value, option, errlist):

    errs = errlist
    fix = None
    try:
        index = self._header.index(keyword)
    except ValueError:
        index = None
    fixable = (fix_value is not None)
    insert_pos = (len(self._header) + 1)
    if _is_int(pos):
        insert_pos = pos
        pos = (lambda x: (x == insert_pos))
    if (index is None):
        err_text = "'{}'    card    does    not    exist.".format(keyword)
        fix_text = "Fixed    by    inserting    a    new    '{}'    card.".format(keyword)
        if fixable:
            card = (keyword, fix_value)
            def fix(self=self, insert_pos=insert_pos, card=card):
                self._header.insert(insert_pos, card)
        errs.append(self.run_option(option, err_text=err_text, fix_text=fix_text, fix=fix, fixable=fixable))
    else:
        if (pos is not None):
            if (not pos(index)):
                err_text = "'{}'    card    at    the    wrong    place    (card    {}).".format(keyword, index)
                fix_text = 'Fixed    by    moving    it    to    the    right    place    (card    {}).'.format(insert_pos)
                def fix(self=self, index=index, insert_pos=insert_pos):
                    card = self._header.cards[index]
                    del self._header[index]
                    self._header.insert(insert_pos, card)
                errs.append(self.run_option(option, err_text=err_text, fix_text=fix_text, fix=fix))
        if test:
            val = self._header[keyword]
            if (not test(val)):
                err_text = "'{}'    card    has    invalid    value    '{}'.".format(keyword, val)
                fix_text = "Fixed    by    setting    a    new    value    '{}'.".format(fix_value)
                if fixable:
                    def fix(self=self, keyword=keyword, val=fix_value):
                        self._header[keyword] = fix_value
                errs.append(self.run_option(option, err_text=err_text, fix_text=fix_text, fix=fix, fixable=fixable))
    return errs
