Squeeze files if there is a pipeline defined for them or leave them be
    otherwise.

    :param filename: filename of the file to process
    :param configuration: configuration dict describing commands and pipelines
    :type configuration: dict
    :return: has file changed
    :rtype: bool

def diet(filename, configuration):
    '''
    Squeeze files if there is a pipeline defined for them or leave them be
    otherwise.

    :param filename: filename of the file to process
    :param configuration: configuration dict describing commands and pipelines
    :type configuration: dict
    :return: has file changed
    :rtype: bool
    '''
    changed = False

    if not isfile(filename):
        raise NotFileDietException('Passed filename does not point to a file')


    conf = copy.deepcopy(DEFAULT_CONFIG)
    if not configuration.get('parsed'):
        new_config = parse_configuration(configuration)
    else:
        new_config = configuration
    update_configuration(conf, new_config)

    filetype = determine_type(filename)
    squeeze_cmd = conf['pipelines'].get(filetype)
    if squeeze_cmd:
        tmpbackup_ext = 'diet_internal'
        ext = conf.get('backup', tmpbackup_ext)
        backup = backup_file(filename, ext)

        size = os.stat(filename).st_size
        new_size = squeeze(squeeze_cmd, filename, backup)

        if not conf.get('keep_processed', False) and new_size > size:
            copy_if_different(backup, filename)

        # Delete backup, if it was internal
        if not conf.get('backup'):
            os.remove(backup)
        changed = True

    return changed