def maplabels(labels):
    """
    Returns a dictionary mapping a set of labels to an index

    :param labels:
    :return:
    """
    poslabels = {}
    for lab, p in zip(labels,range(len(labels))):
        poslabels[lab] = p
    return poslabels