def load_annotations(
    samples,
    anno_key,
    dest_field=None,
    unexpected="prompt",
    cleanup=False,
    progress=None,
    **kwargs,
):
    """Downloads the labels from the given annotation run from the annotation
    backend and merges them into the collection.

    See :ref:`this page <loading-annotations>` for more information about
    using this method to import annotations that you have scheduled by calling
    :func:`annotate`.

    Args:
        samples: a :class:`fiftyone.core.collections.SampleCollection`
        anno_key: an annotation key
        dest_field (None): an optional name of a new destination field
            into which to load the annotations, or a dict mapping field names
            in the run's label schema to new destination field names
        unexpected ("prompt"): how to deal with any unexpected labels that
            don't match the run's label schema when importing. The supported
            values are:

            -   ``"prompt"``: present an interactive prompt to direct/discard
                unexpected labels
            -   ``"ignore"``: automatically ignore any unexpected labels
            -   ``"keep"``: automatically keep all unexpected labels in a field
                whose name matches the the label type
            -   ``"return"``: return a dict containing all unexpected labels,
                or ``None`` if there aren't any
        cleanup (False): whether to delete any informtation regarding this run
            from the annotation backend after loading the annotations
        progress (None): whether to render a progress bar (True/False), use the
            default value ``fiftyone.config.show_progress_bars`` (None), or a
            progress callback function to invoke instead
        **kwargs: keyword arguments for the run's
            :meth:`fiftyone.core.annotation.AnnotationMethodConfig.load_credentials`
            method

    Returns:
        ``None``, unless ``unexpected=="return"`` and unexpected labels are
        found, in which case a dict containing the extra labels is returned
    """
    dataset = samples._root_dataset
    results = dataset.load_annotation_results(anno_key, **kwargs)
    annotations = results.backend.download_annotations(results)
    label_schema = results.config.label_schema
    is_clips_view = results._is_clips
    is_frames_view = results._is_frames

    unexpected_annos = defaultdict(dict)

    for label_field, label_info in label_schema.items():
        label_type = label_info.get("type", None)
        global_attrs, class_attrs = _parse_attributes(label_info)
        allow_additions = label_info.get("allow_additions", True)
        expected_type = _RETURN_TYPES_MAP.get(label_type, None)

        anno_dict = annotations.get(label_field, {})

        if etau.is_str(dest_field):
            if len(label_schema) == 1:
                label_field = dest_field
            else:
                logger.warning(
                    "Ignoring string `dest_field=%s` since the label "
                    "schema contains %d (> 1) fields",
                    dest_field,
                    len(label_schema),
                )
        elif dest_field is not None:
            label_field = dest_field.get(label_field, label_field)

        if is_frames_view:
            label_field, _ = dataset._handle_frame_field(label_field)

        if expected_type and expected_type not in anno_dict:
            anno_dict[expected_type] = {}

        for anno_type, annos in anno_dict.items():
            if anno_type == expected_type:
                # Expected labels
                if label_type == "scalar":
                    _merge_scalars(
                        dataset,
                        annos,
                        results,
                        label_field,
                        label_info=label_info,
                        progress=progress,
                    )
                else:
                    _merge_labels(
                        dataset,
                        annos,
                        results,
                        label_field,
                        label_type,
                        label_info=label_info,
                        global_attrs=global_attrs,
                        class_attrs=class_attrs,
                        progress=progress,
                    )
            else:
                # Unexpected labels
                if not allow_additions:
                    new_field = None
                elif unexpected == "prompt":
                    new_field = _prompt_field(
                        dataset,
                        anno_type,
                        label_field,
                        label_schema,
                        is_frames_view,
                    )
                elif unexpected == "return":
                    new_field = None
                elif unexpected == "keep":
                    new_field = anno_type
                elif isinstance(unexpected, dict):
                    # Undocumented: allow dict mapping to field names
                    new_field = unexpected.get(anno_type, None)
                elif etau.is_container(unexpected) and anno_type in unexpected:
                    # Undocumented: allow list of label types to keep
                    new_field = anno_type
                else:
                    new_field = None

                if new_field:
                    new_field = _handle_frame_fields(
                        dataset, new_field, label_field
                    )

                    if anno_type == "scalar":
                        _merge_scalars(
                            dataset,
                            annos,
                            results,
                            new_field,
                            progress=progress,
                        )
                    else:
                        _merge_labels(
                            dataset,
                            annos,
                            results,
                            new_field,
                            anno_type,
                            progress=progress,
                        )
                else:
                    if label_field:
                        logger.info(
                            "Skipping unexpected labels of type '%s' in field "
                            "'%s'",
                            anno_type,
                            label_field,
                        )
                    else:
                        logger.info("Skipping labels of type '%s'", anno_type)

                    if unexpected == "return":
                        if is_clips_view:
                            _annos = results._to_sample_annos(annos)
                            unexpected_annos[label_field][anno_type] = _annos
                        elif is_frames_view:
                            _label_field = dataset._FRAMES_PREFIX + label_field
                            _annos = results._to_sample_annos(annos)
                            unexpected_annos[_label_field][anno_type] = _annos
                        else:
                            unexpected_annos[label_field][anno_type] = annos

    results.backend.save_run_results(dataset, anno_key, results)

    if cleanup:
        results.cleanup()

    if unexpected == "return":
        return dict(unexpected_annos) if unexpected_annos else None
Downloads the labels from the given annotation run from the annotation
    backend and merges them into the collection.

    See :ref:`this page <loading-annotations>` for more information about
    using this method to import annotations that you have scheduled by calling
    :func:`annotate`.

    Args:
        samples: a :class:`fiftyone.core.collections.SampleCollection`
        anno_key: an annotation key
        dest_field (None): an optional name of a new destination field
            into which to load the annotations, or a dict mapping field names
            in the run's label schema to new destination field names
        unexpected ("prompt"): how to deal with any unexpected labels that
            don't match the run's label schema when importing. The supported
            values are:

            -   ``"prompt"``: present an interactive prompt to direct/discard
                unexpected labels
            -   ``"ignore"``: automatically ignore any unexpected labels
            -   ``"keep"``: automatically keep all unexpected labels in a field
                whose name matches the the label type
            -   ``"return"``: return a dict containing all unexpected labels,
                or ``None`` if there aren't any
        cleanup (False): whether to delete any informtation regarding this run
            from the annotation backend after loading the annotations
        progress (None): whether to render a progress bar (True/False), use the
            default value ``fiftyone.config.show_progress_bars`` (None), or a
            progress callback function to invoke instead
        **kwargs: keyword arguments for the run's
            :meth:`fiftyone.core.annotation.AnnotationMethodConfig.load_credentials`
            method

    Returns:
        ``None``, unless ``unexpected=="return"`` and unexpected labels are
        found, in which case a dict containing the extra labels is returned
    
fiftyone/utils/annotations.py