<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_subdomains_count(self, accepted=True, cur=None):
 """ Fetch subdomain names """

        if accepted:
            accepted_filter = 'WHERE accepted=1'
        else:
            accepted_filter = ''

        get_cmd = "SELECT COUNT(DISTINCT fully_qualified_subdomain) as count FROM {} {};".format(
            self.subdomain_table, accepted_filter)

        cursor = cur
        if cursor is None:
            cursor = self.conn.cursor()

        db_query_execute(cursor, get_cmd, ())

        try:
            rowdata = cursor.fetchone()
            return rowdata['count']
        except Exception as e:
            if BLOCKSTACK_DEBUG:
                log.exception(e)
            return 0