human
Complete this python program:
def LanguageFacet(locale_ident, extra_weights={}):
assistant
#Here is the Python code you requested.

    """Constructs a sorting function that bubbles results from the current
    locale (given by `locale_ident`) to the top of the list.
    `extra_weights` may be a dictionary of weights which will be factored in.
    Intended for use with spelling corrections, which come along with their own
    weightings.
    """
    def score(searcher, docnum):
        doc = searcher.stored_fields(docnum)
        weight = extra_weights.get(doc['name'], 1.0)
        doc_language = doc['language']
        if (doc_language == locale_ident):
            weight *= 2.0
        elif (doc_language == u'roomaji'):
            weight *= 1.4
        return (- weight)
    return whoosh.sorting.FunctionFacet(score)