def select(value, key):
    """
    Select a key from a dictionary.

    If ``value`` is not a dictionary or ``key`` does not exist in it,
    the ``value`` is returned as is.
    """

    return value.get(key, value) if isinstance(value, dict) else value