def METHOD_NAME(key, value, root):
    if isinstance(value, dict):
        root1 = root.create_group(key)
        for k in value:
            METHOD_NAME(k, value[k], root1)
    elif isinstance(value, (tuple, list, RANGE_TYPE)):
        root1 = root.create_group(key + '__from_list__')
        for k, v in enumerate(value):
            METHOD_NAME('%06d'%k, v, root1)
    else:
        try:
            root[key] = value
        except (TypeError, ValueError) as e:
            if not (e.args[0] == "Object dtype dtype('O') has no native HDF5 equivalent" or
                    e.args[0].startswith('could not broadcast input array')):
                raise e
            root1 = root.create_group(key + '__from_list__')
            for k, v in enumerate(value):
                METHOD_NAME('%06d'%k, v, root1)