def cityscapes_palette(num_cls=None):
    """
    Generates the Cityscapes data-set color palette.
    Data-Set URL:
    https://www.cityscapes-dataset.com/
    Color palette definition:
    https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/helpers/labels.py
    Original source taken from:
    https://gluon-cv.mxnet.io/_modules/gluoncv/utils/viz/segmentation.html .

    `num_cls`: the number of colors to generate
    return: the generated color palette
    """
    palette = [
        128, 64, 128,
        244, 35, 232,
        70, 70, 70,
        102, 102, 156,
        190, 153, 153,
        153, 153, 153,
        250, 170, 30,
        220, 220, 0,
        107, 142, 35,
        152, 251, 152,
        0, 130, 180,
        220, 20, 60,
        255, 0, 0,
        0, 0, 142,
        0, 0, 70,
        0, 60, 100,
        0, 80, 100,
        0, 0, 230,
        119, 11, 32,
    ]

    if num_cls is not None:
        if num_cls >= len(palette):
            raise Exception("Palette Color Definition exceeded.")
        palette = palette[:num_cls*3]
    return palette