Run spellcheck on the contents of a file.

    :technical_terms: is a path to a file containing a list of "technical"
    terms. These may be symbols as collected from files by using
    the generic linter or other such symbols. If a symbol-like term is
    used within contents and it does not appear in :technical_terms: then
    an error will result.

    :spellcheck_cache: is a path to a directory where graph files generated
    by the spellchecking engine should be stored. It is used for caching
    purposes between invocations, since generating the spellchecking
    graph is an expensive operation which can take a few seconds to complete.

def spellcheck(contents, technical_terms=None, spellcheck_cache=None):
    """Run spellcheck on the contents of a file.

    :technical_terms: is a path to a file containing a list of "technical"
    terms. These may be symbols as collected from files by using
    the generic linter or other such symbols. If a symbol-like term is
    used within contents and it does not appear in :technical_terms: then
    an error will result.

    :spellcheck_cache: is a path to a directory where graph files generated
    by the spellchecking engine should be stored. It is used for caching
    purposes between invocations, since generating the spellchecking
    graph is an expensive operation which can take a few seconds to complete.
    """
    contents = spelling.filter_nonspellcheckable_tokens(contents)
    contents = _filter_disabled_regions(contents)
    lines = contents.splitlines(True)
    user_words, valid_words = valid_words_dictionary.create(spellcheck_cache)
    technical_words = technical_words_dictionary.create(technical_terms,
                                                        spellcheck_cache)

    return sorted([e for e in spellcheck_region(lines,
                                                valid_words,
                                                technical_words,
                                                user_words)])