Determines if the server needs to authenticate to the database.
        NOTE: we stopped depending on is_auth() since its only a configuration
        and may not be accurate

def needs_to_auth(self, dbname):
        """
        Determines if the server needs to authenticate to the database.
        NOTE: we stopped depending on is_auth() since its only a configuration
        and may not be accurate
        """
        log_debug("Checking if server '%s' needs to auth on  db '%s'...." %
                  (self.id, dbname))
        try:
            client = self.get_mongo_client()
            db = client.get_database(dbname)
            db.collection_names()
            result = False
        except (RuntimeError,Exception), e:
            log_exception(e)
            # updated for to handle auth failures from mongodb 3.6
            result = "authorized" in str(e) or "there are no users authenticated" in str(e)

        log_debug("needs_to_auth check for server '%s'  on db '%s' : %s" %
                  (self.id, dbname, result))
        return result