def get_or_add_image_part(self, image_descriptor):
        """Return |ImagePart| object containing image identified by *image_descriptor*.

        The image-part is newly created if a matching one is not present in the
        collection.
        """
        image = Image.from_file(image_descriptor)
        matching_image_part = self._get_by_sha1(image.sha1)
        if matching_image_part is not None:
            return matching_image_part
        return self._add_image_part(image)
def get_or_add_image_part ( self , image_descriptor ) : image = Image . from_file ( image_descriptor ) matching_image_part = self . _get_by_sha1 ( image . sha1 ) if matching_image_part is not None : return matching_image_part return self . _add_image_part ( image )
Return |ImagePart| object containing image identified by *image_descriptor*.

        The image-part is newly created if a matching one is not present in the
        collection.