Verifies the integrity of a file uploaded to Box

def verify_uploaded_file(
            self,
            destination_folder_id,
            source_path,
            verbose = True,
    ):
        '''
        Verifies the integrity of a file uploaded to Box
        '''
        source_file_size = os.stat(source_path).st_size

        total_part_size = 0
        file_position = 0
        uploaded_box_file_ids = self.find_file( destination_folder_id, os.path.basename( source_path ) )
        total_sha1 = hashlib.sha1()
        for i, file_id in enumerate(uploaded_box_file_ids):
            file_info = self.client.file( file_id = file_id ).get()
            uploaded_sha1 = file_info.response_object['sha1']
            uploaded_size = file_info.response_object['size']

            part_sha1 = read_sha1( source_path, start_byte = file_position, read_size = uploaded_size, extra_hashers = [total_sha1] )
            if part_sha1.hexdigest() != uploaded_sha1:
                print( '\n' )
                print( 'Part sha1: ' + part_sha1.hexdigest() )
                print( 'Uploaded sha1: ' + uploaded_sha1 )
                print('Sha1 hash of uploaded file {0} ({1}) does not match'.format(file_info.response_object['name'], file_id) )
                return False

            file_position += uploaded_size
            total_part_size += uploaded_size
            if len(uploaded_box_file_ids) > 1:
                print( 'Finished verifying part {0} of {1} of {2}'.format( i+1, len(uploaded_box_file_ids), file_id ) )

        assert( source_file_size == total_part_size )

        if verbose:
            print( 'Verified uploaded file {0} ({1}) with sha1: {2}'.format(source_path, file_id, total_sha1.hexdigest()) )

        return True