A Turkish court in Ankara sentenced Istanbul mayor Ekrem Imamoglu to two years and one month in prison for violating election law.