from datetime import datetime


def getUniqueTaskId(prefix=None):
    """
    unique id generator for varius DLS tasks
    :param prefix: prefix for task type
    :return: unique string index (list of indexes can be sorted by date)
    """
    tidx = datetime.now().strftime('%Y%m%d-%H%M%S-%f')
    if prefix is not None:
        tret = '%s-%s' % (prefix, tidx)
    else:
        tret = tidx
    return tret