def _getversion(dictionary):
    """
    Returns the version of the rendering settings format.
    Note: Previously min/max was used to set the channel window start/end
    From version 2 on start/end will be used.

    Parameters:
    dictionary (dictionary): The rendering settings as dictionary

    Returns:
    int: The version or 0 if it cannot be determined
    """
    if 'version' not in dictionary:
        for chindex, chdict in dictionary['channels'].items():
            if ('start' in chdict or 'end' in chdict) and ('min' in chdict or
                'max' in chdict):
                return 0
            if 'start' in chdict or 'end' in chdict:
                return 2
            if 'min' in chdict or 'max' in chdict:
                return 1
    else:
        return dictionary['version']
    return 0
