def tabdetect(file): top = list( filter( ne(0), pluck( 0, Counter( starmap( comp(abs, sub), pairwise( cons(0, map(leadspace, filter(str.strip, file)))))).most_common(2)))) return top[0] if top else 1
def everything_but(k, d): """ Return iterator of all values in d except the values in k. """ assert k in d return concat(itervalues(keyfilter(ne(k), d)))