'The Kindle decides where to open a book based on the presence of
an item in the guide that looks like
<reference type="text" title="Start" href="chapter-one.xhtml"/>
Similarly an item with type="toc" controls where the Goto Table of
Contents operation on the kindle goes.'

def serialize_guide(self):

    buf = self.buf
    hrefs = self.oeb.manifest.hrefs
    buf.write('<guide>')
    for ref in self.oeb.guide.values():
        path = urldefrag(ref.href)[0]
        if ((path not in hrefs) or (hrefs[path].media_type not in OEB_DOCS)):
            continue
        buf.write('<reference    type="')
        if ref.type.startswith(u'other.'):
            self.serialize_text(ref.type.replace(u'other.', u''), quot=True)
        else:
            self.serialize_text(ref.type, quot=True)
        buf.write('"    ')
        if (ref.title is not None):
            buf.write('title="')
            self.serialize_text(ref.title, quot=True)
            buf.write('"    ')
            if is_guide_ref_start(ref):
                self._start_href = ref.href
        self.serialize_href(ref.href)
        buf.write('    />')
    buf.write('</guide>')
