'Generate HTML snippet with prefix character.
Return a <code> snippet for Kindle, <span> snippet for EPUB.
Optimized to preserve first-column alignment for MOBI, EPUB.
Args:
prefix_char (str): prefix character or None
Return:
(str): BeautifulSoup HTML snippet to be inserted into <p> line item entry.'

def format_prefix(self, prefix_char):

    soup = BeautifulSoup('')
    if (self.opts.fmt == 'mobi'):
        codeTag = Tag(soup, 'code')
        if (prefix_char is None):
            codeTag.insert(0, NavigableString('&nbsp;'))
        else:
            codeTag.insert(0, NavigableString(prefix_char))
        return codeTag
    else:
        spanTag = Tag(soup, 'span')
        spanTag['class'] = 'prefix'
        if (prefix_char is None):
            prefix_char = '&nbsp;'
        spanTag.insert(0, NavigableString(prefix_char))
        return spanTag
