def get_pref(prefs, name, request_fn):
    'Get a preference from existing preference dictionary or invoke a function that can collect it from the user'
    val = prefs.get(name)
    if (not val):
        val = request_fn()
        prefs[name] = val
    return val
Get a preference from existing preference dictionary or invoke a function that can collect it from the user
def get_pref(prefs, name, request_fn):
    
    val = prefs.get(name)
    if (not val):
        val = request_fn()
        prefs[name] = val
    return val