def METHOD_NAME(labels, sort_labels=False):
    """ Return OrderedDict of unique labels to number.
    Optionally sort by label.
    """
    labels = Index(lmap(tuple, labels)).unique().tolist()  # squish
    if sort_labels:
        labels = sorted(list(labels))
    d = OrderedDict((k, i) for i, k in enumerate(labels))
    return (d)