<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def zipfiles(self, path=None, arcdirname='data'):
 """Returns a .zip archive of selected rasters."""

        if path:
            fp = open(path, 'w+b')
        else:
            prefix = '%s-' % arcdirname
            fp = tempfile.NamedTemporaryFile(prefix=prefix, suffix='.zip')
        with zipfile.ZipFile(fp, mode='w') as zf:
            for obj in self:
                img = obj.image
                arcname = os.path.join(arcdirname, os.path.basename(img.name))
                try:
                    zf.write(img.path, arcname=arcname)
                except OSError:
                    img.seek(0)
                    zf.writestr(arcname, img.read())
                    img.close()
        fp.seek(0)
        zobj = self.model(image=fp)
        return [zobj]