'Generate book sort key with supplied author_sort.
Generate a sort key of author_sort, title.
Bang, tilde included to force series to sort after non-series books.
Args:
book (dict): book metadata
Return:
(str): sort key'

def _kf_books_by_author_sorter_author_sort(self, book, longest_author_sort=60):

    if (not book['series']):
        fs = (u'{:<%d}!{!s}' % longest_author_sort)
        key = fs.format(capitalize(book['author_sort']), capitalize(book['title_sort']))
    else:
        index = book['series_index']
        integer = int(index)
        fraction = (index - integer)
        series_index = (u'%04d%s' % (integer, str((u'%0.4f' % fraction)).lstrip(u'0')))
        fs = (u'{:<%d}~{!s}{!s}' % longest_author_sort)
        key = fs.format(capitalize(book['author_sort']), self.generate_sort_title(book['series']), series_index)
    return key
