def resolve_setting(default, arg_value=None, env_var=None, config_value=None):
if arg_value is not None:<EOL><INDENT>return arg_value<EOL><DEDENT>else:<EOL><INDENT>env_value = getenv(env_var)<EOL>if env_value is not None:<EOL><INDENT>return env_value<EOL><DEDENT>else:<EOL><INDENT>if config_value is not None:<EOL><INDENT>return config_value<EOL><DEDENT>else:<EOL><INDENT>return default<EOL><DEDENT><DEDENT><DEDENT>
Resolves a setting for a configuration option. The winning value is chosen
from multiple methods of configuration, in the following order of priority
(top first):

- Explicitly passed argument
- Environment variable
- Configuration file entry
- Default

:param arg_value: Explicitly passed value
:param env_var: Environment variable name
:type env_var: string or None
:param config_value: Configuration entry
:param default: Default value to if there are no overriding options
:return: Configuration value