def get_typed(d, key, constructor=None, default=None):
    """
    like dict.get, but if the response/default is not None, pass it to the given constructor.

    Parameters
    ----------
    d : dict
    key : hashable
    constructor : callable
    default

    Returns
    -------

    """
    response = d.get(key, default)
    if constructor is None or response is None:
        return response
    else:
        return constructor(response)
