'Return metadata for the book identified by book_id as a :class:`calibre.ebooks.metadata.book.base.Metadata` object.
Note that the list of formats is not verified. If get_cover is True,
the cover is returned, either a path to temp file as mi.cover or if
cover_as_data is True then as mi.cover_data.'

@api
def get_metadata(self, book_id, get_cover=False, get_user_categories=True, cover_as_data=False):

    with self.safe_read_lock:
        mi = self._get_metadata(book_id, get_user_categories=get_user_categories)
    if get_cover:
        if cover_as_data:
            cdata = self.cover(book_id)
            if cdata:
                mi.cover_data = (u'jpeg', cdata)
        else:
            mi.cover = self.cover(book_id, as_path=True)
    return mi
