def METHOD_NAME(
        required: Union[str, Dict[str, Any]], archive_item: Union[Dict, ArchiveDict, str],
        transform: Callable, result_root: Dict = None, resolve_inplace: bool = False) -> Dict:
    if archive_item is None:
        return None
    if isinstance(required, str):
        if required == 'exclude':
            return None
        if required == 'resolve':
            # TODO this requires to reflect on the definition to determine what are references!
            pass
        elif required in ['*', 'include']:
            pass
        else:
            raise ArchiveQueryError(f'unknown directive {required}')
        return transform(archive_item)
    if not isinstance(required, dict):
        raise ArchiveQueryError('a value in required is neither dict not string directive')
    if isinstance(archive_item, str):
        # The archive item is a reference, the required is still a dict, the references
        # needs to be resolved
        # TODO
        raise ArchiveQueryError(
            f'resolving references in non partial archives is not yet implemented')
    result: Dict[str, Any] = {}
    for key, val in required.items():
        key = key.strip()
        # process array indices
        match = _query_archive_key_pattern.match(key)
        if match:
            key, index = _extract_key_and_index(match)
        elif key == '*':
            # TODO
            raise ArchiveQueryError('key wildcards not yet implemented')
        else:
            raise ArchiveQueryError('invalid key format: %s' % key)
        try:
            archive_child = _extract_child(archive_item, key, index)
            from .storage_v2 import ArchiveList as ArchiveListNew
            if isinstance(archive_child, (ArchiveListNew, ArchiveList, list)):
                result[key] = [METHOD_NAME(
                    val, item, transform=transform) for item in archive_child]
            else:
                result[key] = METHOD_NAME(val, archive_child, transform=transform)
        except (KeyError, IndexError):
            continue
    return result