mka: Refactor the get_*_peer() functions