code: def count_posts(self, tag=None, user_id=None, include_draft=False):
          
          result = 0
          with self._engine.begin() as conn:
              try:
                  count_statement = sqla.select([sqla.func.count()]). \
                      select_from(self._post_table)
                  sql_filter = self._get_filter(tag, user_id, include_draft,
                                                conn)
                  count_statement = count_statement.where(sql_filter)
                  result = conn.execute(count_statement).scalar()
              except Exception as e:
                  self._logger.exception(str(e))
                  result = 0
          return result
docs: Returns the total number of posts for the give filter
  
          :param tag: Filter by a specific tag
          :type tag: str
          :param user_id: Filter by a specific user
          :type user_id: str
          :param include_draft: Whether to include posts marked as draft or not
          :type include_draft: bool
          :return: The number of posts for the given filter.