from typing import Dict
from typing import Any
import copy


def replace_project_info(config: Dict, new_project_id: str) -> Dict[str, Any]:
    """
    Replace all tenant/project info in a `os_client_config` config dict with
    a new project. This is used to bind/scope to another project.
    """
    new_conf = copy.deepcopy(config)
    new_conf.pop('cloud', None)
    new_conf['auth'].pop('project_name', None)
    new_conf['auth'].pop('project_id', None)

    new_conf['auth']['project_id'] = new_project_id

    return new_conf