def recursively_save_dict_contents_to_group(h5file, path, dic):
    """
    ....
    """
    reconstruction_flags = {}
    # reconstruction_key_flags = {}
    for key, item in dic.items():
        if type(key) is not str:
            # import pickle
            # key = pickle.dumps(key).decode("ascii")
            import json
            key = json.dumps(key)

            reconstruction_flags[path + key + "_key_/"] = "json_key"
        if item is None:
            import json
            jitem = json.dumps(item)
            h5file[path + key] = jitem
            reconstruction_flags[path + key + "_typ_/"] = "json_value"
        elif isinstance(item, (np.ndarray, np.int64, np.float64, str, bytes)):
            h5file[path + key] = item
        elif isinstance(item, (float)):
            h5file[path + key] = item
            reconstruction_flags[path + key + "_typ_/"] = "float"
        elif isinstance(item, (int)):
            h5file[path + key] = item
            reconstruction_flags[path + key + "_typ_/"] = "int"
        elif isinstance(item, dict):
            rf = recursively_save_dict_contents_to_group(h5file, path + key + '/', item)
            reconstruction_flags.update(rf)
            # reconstruction_key_flags.update(rkf)
        elif isinstance(item, list):
            # i = iter(item)
            item_dict = dict(zip(range(len(item)), item))
            wholekey = path + key + "_typ_/"
            reconstruction_flags[wholekey] = "list"
            rf = recursively_save_dict_contents_to_group(h5file, path + key + '/', item_dict)
            reconstruction_flags.update(rf)
            # reconstruction_key_flags.update(rkf)
        elif isinstance(item, tuple):
            # i = iter(item)
            item_dict = dict(zip(range(len(item)), item))
            wholekey = path + key + "_typ_/"
            reconstruction_flags[wholekey] = "tuple"
            rf = recursively_save_dict_contents_to_group(h5file, path + key + '/', item_dict)
            reconstruction_flags.update(rf)
        else:
            logger.info("Saving type {} with json".format(type(item)))
            import json
            jitem = json.dumps(item)
            h5file[path + key] = jitem
            reconstruction_flags[path + key + "_typ_/"] = "json_value"
            # raise ValueError('Cannot save %s type'%type(item))
    return reconstruction_flags