def download(self, id, rev=None, destination=None):
        if isinstance(id, CodePackage):
            if rev is None and id.revision is not None:
                rev = id.revision
            id = id.id
        url = "codes/%s/download" % id
        if rev is not None:
            url = "%s?revision=%s" % (url, rev)
        resp = self.client.get(url)
        dest = resp["resp"].getheader("Content-Disposition")
        dest = dest.lstrip("filename=")
        if destination is not None:
            if os.path.isdir(destination):
                dest = os.path.join(destination, dest)
            else:
                dest = destination
        dup_dest = dest
        iteration = 1
        while file_exists(dup_dest) and destination is None:
            iteration += 1
            dup_dest = dest.rstrip(".zip") + " (" + str(iteration) + ").zip"
        f = open(dup_dest, "wb")
        f.write(resp["body"])
        f.close()
        return file_exists(dup_dest)

    #############################################################
    ########################## TASKS ############################
    #############################################################
dataset/ETHPy150Open iron-io/iron_worker_python/iron_worker.py/IronWorker.download/original