'Attempt an operation that accesses an HDU by index/name
that can fail if not all HDUs have been read yet.  Keep
reading HDUs until the operation succeeds or there are no
more HDUs to read.'

def _try_while_unread_hdus(self, func, *args, **kwargs):

    while True:
        try:
            return func(*args, **kwargs)
        except Exception:
            if self._read_next_hdu():
                continue
            else:
                raise
