```python:inference/core/workflows/core_steps/sinks/roboflow/dataset_upload/v1.py
from typing import Optional, Union

import supervision as sv


def is_prediction_registration_forbidden(
    prediction: Optional[Union[sv.Detections, dict]],
) -> bool:
    if prediction is None:
        return True
    
    # Fast path: check if it's a dict first (most common case based on profiling)
    pred_type = type(prediction)
    if pred_type is dict:
        return "top" not in prediction and "predicted_classes" not in prediction
    
    # Check sv.Detections case
    if isinstance(prediction, sv.Detections):
        return len(prediction) == 0
    
    return False
```