U.S. court upholds most of Texas law to punish 'sanctuary cities'