def METHOD_NAME(coco: GtType) -> Tuple[List[Frame], Config]:
    """Transform COCO object to scalabel format."""
    vid_id2name: Optional[Dict[int, str]] = None
    if "videos" in coco:
        vid_id2name = {
            vid["id"]: vid["name"] for vid in coco["videos"]  # type: ignore
        }
    img_id2img: Dict[int, ImgType] = {img["id"]: img for img in coco["images"]}
    cats: List[Optional[Category]] = [
        None for _ in range(len(coco["categories"]))
    ]
    cat_id2name = {}
    uniq_catids = set(category["id"] for category in coco["categories"])
    assert len(uniq_catids) == len(coco["categories"])
    uniq_catids_list = sorted(list(uniq_catids))
    for category in coco["categories"]:
        cat_id2name[category["id"]] = category["name"]
        cats[uniq_catids_list.index(category["id"])] = Category(
            name=category["name"]
        )
    assert None not in cats
    config = Config(categories=cats)
    img_id2anns: Dict[int, List[AnnType]] = {
        img_id: [] for img_id in img_id2img
    }
    for ann in coco["annotations"]:
        if ann["image_id"] not in img_id2anns:
            continue
        img_id2anns[ann["image_id"]].append(ann)
    scalabel: List[Frame] = []
    img_ids = sorted(img_id2img.keys())
    for img_id in tqdm(img_ids):
        img = img_id2img[img_id]
        size = ImageSize(width=img["width"], height=img["height"])
        if "file_name" in img:
            url: Optional[str] = img["file_name"]
        else:
            url = None
        if (
            vid_id2name is not None
            and "video_id" in img
            and img["video_id"] is not None
        ):
            video_name: Optional[str] = vid_id2name[img["video_id"]]
        else:
            video_name = None
        if "frame_id" in img:
            frame_index = img["frame_id"]
        else:
            frame_index = None
        labels: Optional[List[Label]] = None
        if img_id in img_id2anns:
            labels = []
            anns = sorted(img_id2anns[img_id], key=lambda ann: ann["id"])
            for i, ann in enumerate(anns):
                label = Label(
                    id=ann.get(
                        "scalabel_id", str(ann.get("instance_id", ann["id"]))
                    ),
                    index=i + 1,
                    attributes=dict(
                        crowd=bool(ann.get("iscrowd", None)),
                        ignored=bool(ann.get("ignore", None)),
                    ),
                    category=cat_id2name[ann["category_id"]],
                )
                if "score" in ann:
                    label.score = ann["score"]
                if "bbox" in ann and ann["bbox"] is not None:
                    label.box2d = bbox_to_box2d(ann["bbox"])
                if "segmentation" in ann:
                    # Currently only support conversion from polygon.
                    assert ann["segmentation"] is not None
                    if isinstance(ann["segmentation"], list):
                        label.poly2d = polygon_to_poly2ds(ann["segmentation"])
                    else:
                        label.rle = coco_rle_to_rle(ann["segmentation"])
                labels.append(label)
        scalabel.append(
            Frame(
                name=os.path.split(img["file_name"])[-1],
                url=url,
                size=size,
                videoName=video_name,
                frameIndex=frame_index,
                labels=labels,
            )
        )
    return scalabel, config