def download(self, url):
        path, filename = url.rsplit('/', 1)
        
        try:
            request = urllib2.urlopen(url)
        except:
            return url % "failure: unable to fetch %s"
        
        try:
            fh = open(filename, 'w')
        except IOError:
            return "failure: unable to open %s" % filename
            
        while not self.stop_flag.is_set():
            data = request.read(4096)
            
            if not data:
                break
            
            fh.write(data)
        
        return "downloaded %s" % filename
dataset/ETHPy150Open coleifer/irc/botnet/worker.py/WorkerBot.download/swapped operands of `%`