from typing import Hashable
from typing import Optional
from typing import Any


def safe_get_value(maybe_dict, key: Hashable) -> Optional[Any]:
    """
    Get the value for `key` if `maybe_dict` is a `dict` and has that
    key. If `key` isn't there return `None`. Otherwise, `maybe_dict`
    isn't a `dict`, so return `maybe_dict` as is.
    """
    if isinstance(maybe_dict, dict):
        return maybe_dict.get(key, None)
    return maybe_dict