Mark Latham has been found to have engaged in unlawful sexual harassment of a fellow MP by tweeting vulgar references to his homosexuality.