A Russian diplomat accused of spying for the US has been sentenced to 12 years in prison after leaking secrets to the USA.