'Return True iff the database contains an entry with the same title
as the passed in Metadata object. The comparison is case-insensitive.
See also :meth:`data_for_has_book`.'

@read_api
def has_book(self, mi):

    title = mi.title
    if title:
        if isbytestring(title):
            title = title.decode(preferred_encoding, u'replace')
        q = icu_lower(title).strip()
        for title in self.fields[u'title'].table.book_col_map.itervalues():
            if (q == icu_lower(title)):
                return True
    return False
