def unique(seq):
    """List of elements of a sequence 'seq' with duplicates removed, order preserved. (from: http://stackoverflow.com/a/480227/1202674)"""
    if not seq: return []
    seen = set()
    seen_add = seen.add
    return [x for x in seq if x not in seen and not seen_add(x)]