def METHOD_NAME(d):
    """A dictionary sorting key to be utilised on a DICOM JSON representation
    of a Contour Sequence Item
    It sorts first by the SOP Instance UID, and then if that is equal
    it sorts by the length of the contour data itself. If that's equal
    then it is random, but that isn't an issue for this current test
    case."""
    CONTOUR_IMAGE_SEQUENCE_TAG = "30060016"
    REFERENCED_SOP_INSTANCE_UID_TAG = "00081155"
    referenced_sop_instance = d[CONTOUR_IMAGE_SEQUENCE_TAG]["Value"][0][
        REFERENCED_SOP_INSTANCE_UID_TAG
    ]["Value"][0]
    CONTOUR_DATA_TAG = "30060050"
    contour_data = d[CONTOUR_DATA_TAG]["Value"]
    return f"{referenced_sop_instance}.{str(len(contour_data)).zfill(6)}"