def texttoraster(m):
    """Convert the string *m* to a raster image. Any newlines
    in *m* will cause more than one line of output. The
    resulting raster will be taller. Prior to rendering each
    line, it is padded on the right with enough spaces to make
    all lines the same length.
    """

    lines = m.split('\n')
    maxlen = max(len(line) for line in lines)
    justified = [line.ljust(maxlen) for line in lines]
    rasters = [linetoraster(line) for line in justified]
    x, = set(r[0] for r in rasters)
    y = sum(r[1] for r in rasters)
    raster = itertools.chain(*(r[2] for r in rasters))
    return x, y, raster
Convert the string *m* to a raster image. Any newlines
    in *m* will cause more than one line of output. The
    resulting raster will be taller. Prior to rendering each
    line, it is padded on the right with enough spaces to make
    all lines the same length.