human
Write me a the Python code you requested given the following:
Complete the below
def _upload_part(bucketname, aws_key, aws_secret, multipart_id, part_num, source_path, offset, bytes, amount_of_retries=10):

    ''''Uploads a part with retries.
    based on http://www.topfstedt.de/python-parallel-s3-multipart-upload-with-retries.html'
    '''
assistant
#Here is the Python code you requested.
    def _upload(retries_left=amount_of_retries):
        try:
            _logger.info(('Start    uploading    part    #    %d    ...' % part_num))
            conn = boto.connect_s3(aws_key, aws_secret)
            bucket = conn.get_bucket(bucketname)
            for mp in bucket.get_all_multipart_uploads():
                if (mp.id == multipart_id):
                    with FileChunkIO(source_path, 'r', offset=offset, bytes=bytes) as fp:
                        mp.upload_part_from_file(fp=fp, part_num=part_num)
                    break
        except Exception as exc:
            if retries_left:
                _upload(retries_left=(retries_left - 1))
            else:
                logging.info(('...    Failed    uploading    part    #    %d' % part_num))
                raise exc
        else:
            logging.info(('...    Uploaded    part    #    %d' % part_num))
    _upload()