'Keep deleting files from the file_list until the size of the deleted
files is greater than the value in delete_this_much parameter.
:type file_list: list
:param file_list: List of candidate files that can be deleted. This method
will start deleting files from the beginning of the list so the list
should be sorted accordingly. The list must contains 3-element tuples,
positioned as follows: position 0 holds file last accessed timestamp
(as time.struct_time), position 1 holds file path, and position 2 has
file size (e.g., (<access time>, /mnt/data/dataset_1.dat), 472394)
:type delete_this_much: int
:param delete_this_much: Total size of files, in bytes, that should be deleted.'

def __clean_cache(self, file_list, delete_this_much):

    deleted_amount = 0
    for entry in file_list:
        if (deleted_amount < delete_this_much):
            deleted_amount += entry[2]
            os.remove(entry[1])
        else:
            log.debug('Cache    cleaning    done.    Total    space    freed:    %s', convert_bytes(deleted_amount))
            return
