def get_close_matches(word, possibilities, n=<NUM_LIT:3>, cutoff=<NUM_LIT>):
if not n >  <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>" % (n,))<EOL><DEDENT>if not <NUM_LIT:0.0> <= cutoff <= <NUM_LIT:1.0>:<EOL><INDENT>raise ValueError("<STR_LIT>" % (cutoff,))<EOL><DEDENT>result = []<EOL>s = SequenceMatcher()<EOL>s.set_seq2(word)<EOL>for x in possibilities:<EOL><INDENT>s.set_seq1(x)<EOL>if s.real_quick_ratio() >= cutoff ands.quick_ratio() >= cutoff ands.ratio() >= cutoff:<EOL><INDENT>result.append((s.ratio(), x))<EOL><DEDENT><DEDENT>result = heapq.nlargest(n, result)<EOL>return [x for score, x in result]<EOL>
Use SequenceMatcher to return list of the best "good enough" matches.

    word is a sequence for which close matches are desired (typically a
    string).

    possibilities is a list of sequences against which to match word
    (typically a list of strings).

    Optional arg n (default 3) is the maximum number of close matches to
    return.  n must be > 0.

    Optional arg cutoff (default 0.6) is a float in [0, 1].  Possibilities
    that don't score at least that similar to word are ignored.

    The best (no more than n) matches among the possibilities are returned
    in a list, sorted by similarity score, most similar first.

    >>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
    ['apple', 'ape']
    >>> import keyword as _keyword
    >>> get_close_matches("wheel", _keyword.kwlist)
    ['while']
    >>> get_close_matches("apple", _keyword.kwlist)
    []
    >>> get_close_matches("accept", _keyword.kwlist)
    ['except']