from typing import Any


def default_key(obj: object, key: str, default: Any = None) -> Any:
    """Get value by attribute in object or by key in dict.

    If property exists returns value otherwise returns `default` value.
    If object not exist or object don't have property returns `default`.

    Args:
        obj (object, list, tuple, dict): dictionary
        key (str, int): key of property
        default (object): Object that returned if key not found
    Returns:
        value by given key or default
    """
    if obj and isinstance(obj, dict):
        return obj[key] if key in obj else default
    elif obj and isinstance(obj, object):
        return getattr(obj, key, default)
    else:
        return default