def input(message, until, single_char=False, transform=lambda a: a):
    """
    Keeps asking for input (each time in a new line) until a condition
        over the input text evaluates to true. Returns the input. This
        input can be done using text input or character input.
    """
    def _getch(message):
        print(message, end='')
        return getch()

    while True:
        text = transform(line_input(message) if not single_char else _getch(message))
        if until(text):
            return text