@classmethod
def write(cls, msg, x=None, y=None):
    """
        Writes a msg to the screen, with optional x and y values.
        If newlines are present, it goes to the next line.

        :param msg: the message to print
        :param x: optional x value
        :param y: optional y value
        """
    x, y = cls._fix_xy(x, y)
    for i, line in enumerate(msg.splitlines()):
        if y == cls.HEIGHT - 1:
            break
        if len(line) + x >= cls.WIDTH:
            line = line[:cls.WIDTH - x - 1]
        cls.WINDOW.addstr(y, x, line)
        y += 1
