<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setup_config(cfg, config_filenames=None, env_var_name=None):
 """ This will initialize the given configuration object. The following resources are available in the same order: 1) Default settings. 2) Config file. 3) Environment variables. WARNING: Environment variables do _not_ take precedence over the config file right now. (init_from_env will refuse to update the value, if there is already one.) Args: config_filenames: list of possible config filenames env_var_name: name of the environment variable holding the config path """

    if env_var_name is None:
        env_var_name = "BB_CONFIG_FILE"

    config_path = os.getenv(env_var_name, None)
    if not config_path:
        config_path = find_config(defaults=config_filenames)

    if config_path:
        cfg.load(config_path)
        cfg["config_file"] = os.path.abspath(config_path)
    cfg.init_from_env()