'Write the PalmDB header'

def write_header(self):

    title = ascii_filename(unicode(self.oeb.metadata.title[0])).replace(u'    ', u'_')[:31]
    title = (title + ('\x00' * (32 - len(title))))
    now = int(time.time())
    nrecords = len(self.records)
    self.write(title, pack('>HHIIIIII', 0, 0, now, now, 0, 0, 0, 0), 'BOOK', 'MOBI', pack('>IIH', ((2 * nrecords) - 1), 0, nrecords))
    offset = ((self.tell() + (8 * nrecords)) + 2)
    for (i, record) in enumerate(self.records):
        self.write(pack('>I', offset), '\x00', pack('>I', (2 * i))[1:])
        offset += len(record)
    self.write('\x00\x00')
