Generate ``menu`` with the rebuild link.

    :return: HTML fragment
    :rtype: str

def generate_menu():
    """Generate ``menu`` with the rebuild link.

    :return: HTML fragment
    :rtype: str
    """
    if db is not None:
        needs_rebuild = db.get('site:needs_rebuild')
    else:
        needs_rebuild = site.coil_needs_rebuild
    if needs_rebuild not in (u'0', u'-1', b'0', b'-1'):
        return ('</li><li><a href="{0}"><i class="fa fa-fw '
                'fa-warning"></i> <strong>Rebuild</strong></a></li>'.format(
                    url_for('rebuild')))
    else:
        return ('</li><li><a href="{0}"><i class="fa fa-fw '
                'fa-cog"></i> Rebuild</a></li>'.format(url_for('rebuild')))