def initUpload(self, upload):
        """
        Build the request required to initiate an authorized upload to S3.
        """
        if upload['size'] <= 0:
            return upload

        uid = uuid.uuid4().hex
        key = '/'.join(filter(None, (self.assetstore.get('prefix', ''),
                       uid[0:2], uid[2:4], uid)))
        path = '/%s/%s' % (self.assetstore['bucket'], key)
        headers = self._getRequestHeaders(upload)

        chunked = upload['size'] > self.CHUNK_LEN

        upload['behavior'] = 's3'
        upload['s3'] = {
            'chunked': chunked,
            'chunkLength': self.CHUNK_LEN,
            'relpath': path,
            'key': key
        }

        if chunked:
            upload['s3']['request'] = {'method': 'POST'}
            alsoSignHeaders = {}
            queryParams = {'uploads': None}
        else:
            upload['s3']['request'] = {'method': 'PUT'}
            alsoSignHeaders = {
                'Content-Length': upload['size']
            }
            queryParams = None
        url = self._botoGenerateUrl(
            method=upload['s3']['request']['method'], key=key,
            headers=dict(headers, **alsoSignHeaders), queryParams=queryParams,
            chunkedUpload=chunked)
        upload['s3']['request']['url'] = url
        upload['s3']['request']['headers'] = headers
        return upload
dataset/ETHPy150Open girder/girder/girder/utility/s3_assetstore_adapter.py/S3AssetstoreAdapter.initUpload/original