'Add an image to a collection
:param collection_id: a valid collection id
:param image_file: a file object of an image
:param metadata: metadata describing the image, must be convertable to
JSON
:return:'

def add_image(self, collection_id, image_file, metadata=None):

    metadata = (metadata or {})
    filename = image_file.name
    mime_type = (mimetypes.guess_type(filename)[0] or 'application/octet-stream')
    return self.request(method='POST', url='/v3/collections/{0}/images'.format(collection_id), params={'version': self.version}, files={'image_file': (filename, image_file, mime_type), 'metadata': ('metadata.json', json.dumps(metadata), 'application/json')}, accept_json=True)
