from typing import Any


def mask_password(name: str = None, value: Any = None) -> Any:
    """
    Mask password in the object.

    :param name: 'param-name'
    :param value: 'param-value'
    :return: new object with masked password
    """

    # default -----
    if name is None:
        name = ''

    if value is None:
        value = ''

    # init -----
    if isinstance(value, dict):
        return {
            k: mask_password(name=k, value=v)
            for k, v in value.items()
        }

    elif isinstance(value, list):
        return [
            mask_password(name=name, value=v)
            for v in value
        ]

    elif isinstance(value, tuple):
        return tuple(
            mask_password(name=name, value=v)
            for v in value
        )

    elif isinstance(value, str) and ('password' in name.lower() or 'pwd' in name.lower()):
        return '*' * len(value)

    return value
