<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def terminal_size():
 """ Detect the current size of terminal window as a numer of rows and columns. """

    try:
        (rows, columns) = os.popen('stty size', 'r').read().split()
        rows    = int(rows)
        columns = int(columns)
        return (columns, rows)

    # Currently ignore any errors and return some reasonable default values.
    # Errors may occur, when the library is used in non-terminal application
    # like daemon.
    except:
        pass
    return (80, 24)