import itertools


def splitOnCondition(seq, condition):
    """
    Splits a list of tuples (<x>,<y>) in two lists, depending on the condition
    on <y>. Returns the <x> elements as tuple of two lists.
    """
    l1,l2 = itertools.tee((condition(item),item) for item in seq)
    return ([i[0] for p, i in l1 if p], [i[0] for p, i in l2 if not p])