<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def put(self, x, y, text, fg, bg):
 """ Puts a string at the desired coordinates using the provided colors. :param x: X position :param y: Y position :param text: Text to write :param fg: Foreground color number :param bg: Background color number """

        if x < self.width and y < self.height:
            try:
                self.screen.addstr(y, x, symbols.encode(text), self.pairs[fg, bg])
            except curses.error:
                # Ignore out of bounds error
                pass