<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def upsample(self, factor):
 """ The inverse operation of rebin, applied on the PIL image. Do this before writing text or drawing on the image ! The coordinates will be automatically converted for you """

        
        self.checkforpilimage()
        
        if type(factor) != type(0):
            raise RuntimeError, "Upsample factor must be an integer !"
        
        if self.verbose:
            print "Upsampling by a factor of %i" % factor
        self.pilimage = self.pilimage.resize((self.pilimage.size[0] * factor, self.pilimage.size[1] * factor))
        self.upsamplefactor = factor
        
        self.draw = None