from typing import Any
from typing import List
import functools


def rgetattr(obj: Any, attr: str, *args: List[Any]) -> Any:
    """
    Recursively getting attribute

    Parameters
    ----------
    obj : Any
        An object
    attr : str
        The name of the attriute to get. Can contain dots.
    """

    def _getattr(obj, attr):
        return None if obj is None else getattr(obj, attr, *args)

    return functools.reduce(_getattr, [obj] + attr.split("."))