def get_default(dct, key, default=None, fn=None):
    """Get a value from a dict and transform if not the default."""
    value = dct.get(key, default)
    if fn is not None and value != default:
        return fn(value)
    return value