from six import string_types


def listify(arg):
    """
    Simple utility method to ensure an argument provided is a list. If the provider argument is not an instance of
    `list`, then we return [arg], else arg is returned.

    :type arg: list
    :rtype: list
    """
    if not isinstance(arg, list):
        return [arg]
    return arg


def is_str(arg):
    """
    A py2/3 compatible 'is string' check.

    :type arg:
    :rtype:
    """
    return isinstance(arg, string_types)

@@ -1,8 +1,30 @@
+from os import getenv%0A
 from six
@@ -505,8 +505,962 @@
 _types)%0A
+%0A%0Adef resolve_setting(default, arg_value=None, env_var=None, config_value=None):%0A    %22%22%22%0A    Resolves a setting for a configuration option. The winning value is chosen from multiple methods of configuration,%0A    in the following order of priority (top first):%0A    - Explicitly passed argument%0A    - Environment variable%0A    - Configuration file entry%0A    - Default%0A%0A    :param arg_value: Explicitly passed value%0A    :param env_var: Environment variable name%0A    :type env_var: string or None%0A    :param config_value: Configuration entry%0A    :param default: Default value to if there are no overriding options%0A    :return: Configuration value%0A    %22%22%22%0A    if arg_value is not None:%0A        return arg_value%0A    else:%0A        env_value = getenv(env_var)%0A        if env_value is not None:%0A            return env_value%0A        else:%0A            if config_value is not None:%0A                return config_value%0A            else:%0A                return default%0A

Add function to resolve settings from multiple sources