def METHOD_NAME(
    encoded_batch: BatchEncoding, keys: Optional[List[str]] = None, renamed_keys: Optional[List[str]] = None
):
    if encoded_batch is None:
        return []
    if not keys:
        keys = list(encoded_batch.keys())
    if not renamed_keys:
        renamed_keys = keys
    assert len(keys) == len(
        renamed_keys
    ), f"keys and renamed_keys have different size {len(keys)} != {len(renamed_keys)}"
    assert any(key in encoded_batch for key in keys), f"one of the keys {keys} is not in batch {encoded_batch.keys()}"
    features_flat = []
    for item in range(len(encoded_batch[keys[0]])):
        feat_dict = {k: v for k, v in zip(renamed_keys, [encoded_batch[k][item] for k in keys])}
        features_flat.append(feat_dict)
    return features_flat