<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def draw_text(stdscr, text, color=0, fallback=None, title=None):
 """ Draws text in the given color. Duh. """

    if fallback is None:
        fallback = text
    y, x = stdscr.getmaxyx()
    if title:
        title = pad_to_size(title, x, 1)
        if "\n" in title.rstrip("\n"):
            # hack to get more spacing between title and body for figlet
            title += "\n" * 5
        text = title + "\n" + pad_to_size(text, x, len(text.split("\n")))
    lines = pad_to_size(text, x, y).rstrip("\n").split("\n")

    try:
        for i, line in enumerate(lines):
            stdscr.insstr(i, 0, line, curses.color_pair(color))
    except:
        lines = pad_to_size(fallback, x, y).rstrip("\n").split("\n")
        try:
            for i, line in enumerate(lines[:]):
                stdscr.insstr(i, 0, line, curses.color_pair(color))
        except:
            pass
    stdscr.refresh()