from collections.abc import Mapping
from typing import Any
def data_get(target: Mapping[str, Any], key: str, default: Any = None) -> Any:
result = default
if not target:
return result
if not key:
return result
current = target
keys = key.split('.')
for k in keys:
if not isinstance(current, Mapping) or k not in current:
return result
current = current[k]
result = current
return result