Former LAPD detective sentenced to 27 years