private def flattenAnything(x: Any): Seq[Object] = x match { case so: Seq[Object] => so flatMap (flattenAnything) case ob: Object => List(ob) case junk: Any => throw new IllegalArgumentException("Cannot flatten " + junk) }