<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _read_until(infile=sys.stdin, maxchars=20, end=RS):
    ''' Read a terminal response of up to a few characters from stdin.  '''
    chars = []
    read = infile.read
    if not isinstance(end, tuple):
        end = (end,)

    # count down, stopping at 0
    while maxchars:
        char = read(1)
        if char in end:
            break
        chars.append(char)
        maxchars -= 1

    return ''.join(chars)