Introduce function get_shares() and make use of it in is_shared() function