A dog that was unwanted and due to be put down has become a qualified search and rescue dog