def download_labels_from_labelbox(
    labelbox_project,
    outpath=None,
    export_version=LabelboxExportVersion.V2,
):
    """Downloads the labels for the given Labelbox project.

    Args:
        labelbox_project: a ``labelbox.schema.project.Project``
        outpath (None): the path to write the JSON export on disk
        export_version ("v2"): the Labelbox export format and API version to
            use. Supported values are ``("v1", "v2")``

    Returns:
        ``None`` if an ``outpath`` is provided, or the loaded JSON itself if no
        ``outpath`` is provided
    """
    if export_version == LabelboxExportVersion.V1:
        return _download_labels_from_labelbox_v1(
            labelbox_project, outpath=outpath
        )

    params = {
        "data_row_details": True,
        "metadata_fields": True,
        "attachments": True,
        "project_details": True,
        "performance_details": True,
        "label_details": True,
        "interpolated_frames": True,
    }

    export_task = labelbox_project.export_v2(params=params)

    export_task.wait_till_done()
    if export_task.errors:
        logger.warning(export_task.errors)

    export_json = export_task.result

    if outpath:
        etas.write_json(export_json, outpath)
        return None

    return export_json
Downloads the labels for the given Labelbox project.

    Args:
        labelbox_project: a ``labelbox.schema.project.Project``
        outpath (None): the path to write the JSON export on disk
        export_version ("v2"): the Labelbox export format and API version to
            use. Supported values are ``("v1", "v2")``

    Returns:
        ``None`` if an ``outpath`` is provided, or the loaded JSON itself if no
        ``outpath`` is provided
    
fiftyone/utils/labelbox.py