<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resolved_option(options, target, key):
 """Get value for option "key". Resolution precedence is CLI option > target option > pants.ini option. :param options: Options returned by `task.get_option()` :param target: Target :param key: Key to get using the resolution precedence """

    option_value = options.get(key)
    if not isinstance(target, AppBase) or options.is_flagged(key):
      return option_value
    v = target.payload.get_field_value(key, None)
    return option_value if v is None else v