def _put_file(self, file):
        """Send PUT request to S3 with file contents"""

        post_params = {
            'file_size': file.size,
            'file_hash': file.md5hash(),
            'content_type': self._get_content_type(file),

        }

        headers = self._request_headers('PUT', file.prefixed_name, post_params=post_params)

        with closing(HTTPConnection(self.netloc)) as conn:
            conn.request('PUT', file.prefixed_name, file.read(), headers=headers)
            response = conn.getresponse()

            if response.status not in (200,):
                raise S3IOError(
                    'py3s3 PUT error. '
                    'Response status: {}. '
                    'Reason: {}. '
                    'Response Text: \n'
                    '{}'.format(response.status, response.reason, response.read()))
Send PUT request to S3 with file contents