def ifindict(d: dict, k: str, default: any) ->any:
    """
    Returns the value of `k` inside `d` if it exists; returns `default` otherwise.

    Parameters
    ----------
    d : dict
        The source dict.
    k : str
        The lookup key
    default : any
        The default return value when `k` is not in `d`.

    Examples
    --------
    >>> d = dict(a=5, b=6)
    >>> ifindict(d, 'a', 'default-value')
    5
    >>> ifindict(d, 'some_invalid_key', 42)
    42
    """
    return d[k] if k in d else default
