from typing import Any


def _resolveNamespace(doc: dict[str, Any], namespace: list[str] | None = None) -> dict[str, Any]:
	"""Take some document object and set the root to the namespace.

	Args:
		doc (dict[str, Any]): some document object dict[str, Any]
		namespace (list[str], optional): a list representing a namespace. e.g.
		["tool", "poetry"]. Defaults to None.

	Returns:
		dict[str, Any]: resolved document
	"""
	if namespace is None:
		return doc
	for part in namespace:
		doc = doc[part]
	return doc