import ast


def applyTypeConversions(settingObj, value):
    """
    Coerce value to proper type given a valid setting object.

    Useful in converting XML settings with no type info (all string) as well as
    in GUI operations.
    """
    if settingObj.underlyingType == list and not isinstance(value, list):
        return ast.literal_eval(value)
    return value