<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def image_size(self, pnmfile):
 """Get width and height of pnm file. simeon@homebox src>pnmfile /tmp/214-2.png /tmp/214-2.png:PPM raw, 100 by 100 maxval 255 """

        pout = os.popen(self.shellsetup + self.pnmfile + ' ' + pnmfile, 'r')
        pnmfileout = pout.read(200)
        pout.close()
        m = re.search(', (\d+) by (\d+) ', pnmfileout)
        if (m is None):
            raise IIIFError(
                text="Bad output from pnmfile when trying to get size.")
        w = int(m.group(1))
        h = int(m.group(2))
        # print "pnmfile output = %s" % (pnmfileout)
        # print "image size = %d,%d" % (w,h)
        return(w, h)