'Return the ids of all books having the tag ``tag`` that are older than
than the specified time. tag comparison is case insensitive.
:param delta: A timedelta object or None. If None, then all ids with
the tag are returned.
:param must_have_tag: If not None the list of matches will be
restricted to books that have this tag
:param must_have_authors: A list of authors. If not None the list of
matches will be restricted to books that have these authors (case
insensitive).'

def tags_older_than(self, tag, delta, must_have_tag=None, must_have_authors=None):

    tag = tag.lower().strip()
    mht = (must_have_tag.lower().strip() if must_have_tag else None)
    now = nowf()
    tindex = self.FIELD_MAP['timestamp']
    gindex = self.FIELD_MAP['tags']
    iindex = self.FIELD_MAP['id']
    aindex = self.FIELD_MAP['authors']
    mah = must_have_authors
    if (mah is not None):
        mah = [x.replace(',', '|').lower() for x in mah]
        mah = ','.join(mah)
    for r in self.data._data:
        if (r is not None):
            if ((delta is None) or ((now - r[tindex]) > delta)):
                if mah:
                    authors = (r[aindex] or '')
                    if (authors.lower() != mah):
                        continue
                tags = r[gindex]
                if tags:
                    tags = [x.strip() for x in tags.lower().split(',')]
                    if ((tag in tags) and ((mht is None) or (mht in tags))):
                        (yield r[iindex])
