def resolve(name, user_config, flags, default=None):
    """Resolve the provided option from either user_config or flags.

    If neither is set, use the default.
    If both are set, the flags take precedence.
    """
    answer = user_config.get(name, default)
    if getattr(flags, name, None):
        answer = getattr(flags, name)
    return answer