def spellcheck(word, wordlist, depth = 2):
    """
    Given a word list and a depth parameter, return all words w' in the wordlist
    with LevenshteinDistance(word, w') <= depth

    :param word:
    :param wordlist:

    >>> Dic = ['pes', 'pesse', 'pease', 'peis', 'peisse', 'pise', 'peose', 'poese', 'poisen']
    >>> spellcheck('pece', Dic, depth = 2)
    ['pease', 'peis', 'peose', 'pes', 'pesse', 'pise', 'poese']

    >>> spellcheck('pece', Dic, depth = 3)
    ['pease', 'peis', 'peisse', 'peose', 'pes', 'pesse', 'pise', 'poese']
    """
    Aut = LevenshteinAutomaton(word, depth = depth).convert_to_deterministic()
    W = make_worlist_trie(wordlist)

    return sorted(list(walk_trie(W, '', Aut.s, Aut)))