def _do_remove_shard(self, shard, unsharded_data_dest_id=None):
        cmd = self.get_validate_remove_shard_command(shard)
        mongos = self.get_any_online_mongos()

        log_info("Executing command \n%s\non mongos '%s'" %
                 (document_pretty_string(cmd), mongos.id))

        result = mongos.db_command(cmd, "admin")

        log_info("Command result: \n%s" % result)

        if "dbsToMove" in result and unsharded_data_dest_id:
            dest_shard_member = self.get_shard_member_by_shard_id(
                unsharded_data_dest_id)

            if not dest_shard_member:
                raise Exception("No such shard '%s' in ShardedCluster '%s' " %
                                (unsharded_data_dest_id, self.id))

            dest_shard = dest_shard_member.get_shard()
            self.move_dbs_primary(result["dbsToMove"], dest_shard)


        if result.get('state') == "completed":
            log_info("Shard '%s' removed successfully!" % self.id)

        return result

    ###########################################################################
dataset/ETHPy150Open mongolab/mongoctl/mongoctl/objects/sharded_cluster.py/ShardedCluster._do_remove_shard/original