<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_to_field_if_exists(effect, field_name, fn, default):
 """ Apply function to specified field of effect if it is not None, otherwise return default. """

    value = getattr(effect, field_name, None)
    if value is None:
        return default
    else:
        return fn(value)