from typing import Sequence
from typing import Dict
from typing import Union


def get_instance_class_from_properties_seq(
        instance_idx: Sequence, map_dict: Dict[str, Union[str, int]]) -> Sequence:
    """
    Extract instance classes form mapping dict

    Args:
        instance_idx: instance ids present in segmentaion
        map_dict: dict mapping instance ids (keys) to classes

    Returns:
        Sequence[int]: extracted instance classes
    """
    instance_idx = sorted(instance_idx)
    classes = [int(map_dict[str(int(idx))]) for idx in instance_idx]
    return classes