def _put_object(self, upload_func, upload_func_args, container, object_name,
                    extra=None, file_path=None, iterator=None, file_hash=None):
        container_name_cleaned = self._clean_container_name(container.name)
        object_name_cleaned = self._clean_object_name(object_name)

        extra = extra or {}
        content_type = extra.get('content_type', None)
        meta_data = extra.get('meta_data', None)

        if not content_type:
            if file_path:
                name = file_path
            else:
                name = object_name
            content_type, _ = utils.guess_file_mime_type(name)

            if not content_type:
                raise AttributeError('File content-type could not be guessed and' +
                                     ' no content_type value provided')

        headers = {}
        if iterator:
            headers['Transfer-Encoding'] = 'chunked'
            upload_func_args['chunked'] = True
        else:
            file_size = os.path.getsize(file_path)
            headers['Content-Length'] = file_size
            upload_func_args['chunked'] = False

            if file_hash:
                headers['ETag'] = file_hash

        headers['Content-Type'] = content_type

        if meta_data:
            for key, value in meta_data.iteritems():
                key = 'X-Object-Meta-%s' % (key)
                headers[key] = value

        response = self.connection.request('/%s/%s' % (container_name_cleaned,
                                                       object_name_cleaned),
                                           method='PUT', data=None,
                                           headers=headers, raw=True)

        upload_func_args['response'] = response
        success, data_hash, bytes_transferred = upload_func(**upload_func_args)

        if not success:
            raise LibcloudError('Object upload failed, Perhaps a timeout?')

        response = response.response

        if response.status == httplib.EXPECTATION_FAILED:
            raise LibcloudError('Missing content-type header')
        elif response.status == httplib.UNPROCESSABLE_ENTITY:
            raise ObjectHashMismatchError(value='MD5 hash checksum does not match',
                                          object_name=object_name, driver=self)
        elif response.status == httplib.CREATED:
            obj = Object(name=object_name, size=bytes_transferred, hash=file_hash,
                         extra=None, meta_data=meta_data, container=container,
                         driver=self)

            return obj
dataset/ETHPy150Open cloudkick/libcloud/libcloud/storage/drivers/cloudfiles.py/CloudFilesStorageDriver._put_object/original