def safe_get(d, key):
    """Helper function.

    :param d: dictionary
    :type d: dict
    :param key: key to retrieve from dict
    :type key: str
    :return: value of specified key if not None, otherwise empty dict
    """
    if key in d and d[key] is not None:
        return d[key]
    return {}
