def suggestion_list(input_: str, options: Collection[str]):
    """Get list with suggestions for a given input.

    Given an invalid input string and list of valid options, returns a filtered list
    of valid options sorted based on their similarity with the input.
    """
    options_by_distance = {}
    input_threshold = len(input_) // 2

    for option in options:
        distance = lexical_distance(input_, option)
        threshold = max(input_threshold, len(option) // 2, 1)
        if distance <= threshold:
            options_by_distance[option] = distance

    return sorted(options_by_distance, key=options_by_distance.get)
Get list with suggestions for a given input.

    Given an invalid input string and list of valid options, returns a filtered list
    of valid options sorted based on their similarity with the input.