'Return absolute path to the ebook file of format `format`
WARNING: This method will return a dummy path for a network backend DB,
so do not rely on it, use format(..., as_path=True) instead.
Currently used only in calibredb list, the viewer and the catalogs (via
get_data_as_dict()).
Apart from the viewer, I don\'t believe any of the others do any file
I/O with the results of this call.'

def format_abspath(self, index, format, index_is_id=False):

    id = (index if index_is_id else self.id(index))
    try:
        name = self.format_filename_cache[id][format.upper()]
    except:
        return None
    if name:
        path = os.path.join(self.library_path, self.path(id, index_is_id=True))
        format = (('.' + format.lower()) if format else '')
        fmt_path = os.path.join(path, (name + format))
        if os.path.exists(fmt_path):
            return fmt_path
        try:
            candidates = glob.glob(os.path.join(path, ('*' + format)))
        except:
            candidates = []
        if (format and candidates and os.path.exists(candidates[0])):
            try:
                shutil.copyfile(candidates[0], fmt_path)
            except:
                return None
            return fmt_path
