@classmethod
def from_string(cls, s):
    """
    Create ``Mode`` object from its string representation. It's a comma-separated
    list of for items:

    +--------------+----------+-----------------+-----------------------+-----------------+
    |              | ``type`` | ``width``       | ``height``            | ``depth``       |
    +--------------+----------+-----------------+-----------------------+-----------------+
    | Text mode    | ``t``    | chars per line  | lines on screen       | bytes per char  |
    +--------------+----------+-----------------+-----------------------+-----------------+
    | Graphic mode | ``g``    | pixels per line | pixel lines on screen | bites per pixel |
    +--------------+----------+-----------------+-----------------------+-----------------+
    """
    t, c, r, b = s.strip().split(',')
    return cls(t, int(c.strip()), int(r.strip()), int(b.strip()))
