'A more accurate but much more resource intensive and slower
method to calculate the page length.
Parses the uncompressed text. In an average paper back book
There are 32 lines per page and a maximum of 70 characters
per line.
Each paragraph starts a new line and every 70 characters
(minus markup) in a paragraph starts a new line. The
position after every 30 lines will be marked as a new
page.
This can be make more accurate by accounting for
<div class="mbp_pagebreak" /> as a new page marker.
And <br> elements as an empty line.'

def get_pages_accurate(self, mobi_file_path):

    pages = []
    mr = MobiReader(mobi_file_path, default_log)
    if (mr.book_header.encryption_type != 0):
        return self.get_pages_fast(mobi_file_path)
    mr.extract_text()
    in_tag = False
    in_p = False
    check_p = False
    closing = False
    p_char_count = 0
    lines = []
    pos = (-1)
    for c in mr.mobi_html.lower():
        pos += 1
        if check_p:
            if (c == '/'):
                closing = True
                continue
            elif (c == 'p'):
                if closing:
                    in_p = False
                else:
                    in_p = True
                    lines.append((pos - 2))
            check_p = False
            closing = False
            continue
        if (c == '<'):
            in_tag = True
            check_p = True
            continue
        elif (c == '>'):
            in_tag = False
            check_p = False
            continue
        if (in_p and (not in_tag)):
            p_char_count += 1
            if (p_char_count == 70):
                lines.append(pos)
                p_char_count = 0
    for i in xrange(0, len(lines), 32):
        pages.append(lines[i])
    return pages
