def generate_preset(preset, set=True):
    """
    Generate the preset value based on the preset index
    ... and whether it's being set/retrieved
    """
    return 30 + 2 * (preset - 1) + int(not bool(set))
