def copyImage(self, imageId, folderName, folderDate):
        """
        Copy an image from the library to a folder in the dest_dir. The
        name of the folder is based on folderName and folderDate; if
        folderDate is None, it's only based upon the folderName.

        If use_metadata is True, also write the image metadata from the library
        to the copy. If use_faces is True, faces will be saved as keywords.
        """
        try:
            image = self.images[imageId]
        except __HOLE__:
            raise iPhotoLibraryError, "Can't find image #%s" % imageId

        if not os.path.exists(folderName):
            try:
                if not self.test:
                    os.makedirs(folderName)
            except OSError, why:
                raise iPhotoLibraryError, \
                    "Can't create %s: %s" % (folderName, why[1])
            self.status("  Created %s\n" % folderName)

        #Unedited images only have ImagePath, edited images have both ImagePath and OriginalPath,
        #except for some corrupted iPhoto libraries, where some images only have OriginalPath.
        #Trying to satisfy both conditions with this nested logic.
        if self.originals:
            if "OriginalPath" in image:
                mFilePath = image["OriginalPath"]
            else:
                mFilePath = image["ImagePath"]
        else:
            if not "ImagePath" in image:
                mFilePath = image["OriginalPath"]
            else:
                mFilePath = image["ImagePath"]
        basename = os.path.basename(mFilePath)

        # Deconflict ouput filenames
        tFilePath = os.path.join(folderName, basename)
        if self.deconflict:
            j = 1
            while tFilePath in self.output_files:
                tFilePath = os.path.join(folderName, "%02d_"%j + basename)
                j += 1
            self.output_files.add(tFilePath)

        # Skip unchanged files, unless we're writing metadata.
        if not self.use_metadata and os.path.exists(tFilePath):
            mStat = os.stat(mFilePath)
            tStat = os.stat(tFilePath)

            if not self.ignore_time_delta and abs(tStat[stat.ST_MTIME] - mStat[stat.ST_MTIME]) <= 10:
                self.status("-")
                return

            if tStat[stat.ST_SIZE] == mStat[stat.ST_SIZE]:
                self.status("-")
                return

        if not self.test and os.path.exists(mFilePath):
            shutil.copy2(mFilePath, tFilePath)
        md_written = False
        if self.use_metadata:
            md_written = self.writePhotoMD(imageId, tFilePath)
        if md_written:
            self.status("+")
        else:
            self.status(".")
dataset/ETHPy150Open BMorearty/exportiphoto/exportiphoto.py/iPhotoLibrary.copyImage