def correct_text(spellcheck, input):
    """
    Checks whether the input is correctly spelled and correct it otherwise
    Returns the corrected input
    """
    output = input

    ok = spellcheck.spell(input)
    if not ok:
        suggestions = spellcheck.suggest(input)
        if len(suggestions) > 0:
            output = suggestions[0]
            # print(f"{input} -> {output}")

    return output