Effect of transition metal dopants on the optical and magnetic properties of semiconductor nanocrystals