def safe_izip(*args):
 assert all([(len(arg) == len(args[0])) for arg in args])
 return izip(*args)

def safe_izip ( * args ) : assert all ( [ ( len ( arg ) == len ( args [ 0 ] ) ) for arg in args ] ) return izip ( * args )
like izip .