def lcopt_bw2_autosetup(ei_username=None, ei_password=None, write_config=None, ecoinvent_version='3.3', ecoinvent_system_model = "cutoff", overwrite=False):  
    ei_name = "Ecoinvent{}_{}_{}".format(*ecoinvent_version.split('.'), ecoinvent_system_model)
    config = check_for_config()
    if config is None:
        config = DEFAULT_CONFIG
        with open(storage.config_file, "w") as cfg:
            yaml.dump(config, cfg, default_flow_style=False)
    store_option = storage.project_type
    if store_option == 'single':
        project_name = storage.single_project_name
        if bw2_project_exists(project_name):
            bw2.projects.set_current(project_name)
            if ei_name in bw2.databases and overwrite == False:
                return True
    else:
        project_name = DEFAULT_PROJECT_STEM + ei_name
        if bw2_project_exists(project_name):
            if overwrite:                                           
                bw2.projects.delete_project(name=project_name, delete_dir=True)
    auto_ecoinvent = partial(eidl.get_ecoinvent,db_name=ei_name, auto_write=True, version=ecoinvent_version, system_model=ecoinvent_system_model)
    if config is not None:
        if "ecoinvent" in config:
            if ei_username is None:
                ei_username = config['ecoinvent'].get('username')
            if ei_password is None:
                ei_password = config['ecoinvent'].get('password')
            write_config = False
    if ei_username is None:
        ei_username = input('ecoinvent username: ')
    if ei_password is None:
        ei_password = getpass.getpass('ecoinvent password: ')
    if write_config is None:
        write_config = input('store username and password on this computer? y/[n]') in ['y', 'Y', 'yes', 'YES', 'Yes']
    if write_config:
        config['ecoinvent'] = {
            'username': ei_username,
            'password': ei_password
        }
        with open(storage.config_file, "w") as cfg:
            yaml.dump(config, cfg, default_flow_style=False)
    if store_option == 'single':
        if bw2_project_exists(project_name):
            bw2.projects.set_current(project_name)
        else:
            if not bw2_project_exists(DEFAULT_BIOSPHERE_PROJECT):
                bw2.projects.set_current(project_name)
                bw2.bw2setup()
            else:
                bw2.projects.set_current(DEFAULT_BIOSPHERE_PROJECT)
                bw2.create_core_migrations()
                bw2.projects.copy_project(project_name, switch=True)
    else:
        if not bw2_project_exists(DEFAULT_BIOSPHERE_PROJECT):
            lcopt_biosphere_setup()
        bw2.projects.set_current(DEFAULT_BIOSPHERE_PROJECT)
        bw2.create_core_migrations()
        bw2.projects.copy_project(project_name, switch=True)
    if ei_username is not None and ei_password is not None:
        auto_ecoinvent(username=ei_username, password=ei_password)
    else:
        auto_ecoinvent()
    write_search_index(project_name, ei_name, overwrite=overwrite)
    return True