it takes one to know one

(It) takes one to know one (you are one also; only a person with identical character traits would be able to recognize those traits in someone else) {infml} ~ Рыбак рыбака видит издалека; на себя посмотри; чья бы корова мычала

Often used as a curt rejoinder to deflect an accusation: you're only saying that about me because it's true of you.

Example 1: "Who are you, anyway?" "Another loser I met on the Internet". (...) "Takes one to know one". (Sex and the City. Candace Bushnell)

Example 2: "You are a stupid oaf". "So are you. It takes one to know one". (idioms.thefreedictionary.com)

See also
[чья бы корова мычала]
[birds of a feather]
[two of a kind]