Get and all subdomain names, optionally over a range

def get_all_subdomains(self, offset=None, count=None, min_sequence=None, cur=None):
        """
        Get and all subdomain names, optionally over a range
        """
        get_cmd = 'SELECT DISTINCT fully_qualified_subdomain FROM {}'.format(self.subdomain_table)
        args = ()

        if min_sequence is not None:
            get_cmd += ' WHERE sequence >= ?'
            args += (min_sequence,)

        if count is not None:
            get_cmd += ' LIMIT ?'
            args += (count,)

        if offset is not None:
            get_cmd += ' OFFSET ?'
            args += (offset,)

        get_cmd += ';'

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

        rows = db_query_execute(cursor, get_cmd, args)
        subdomains = []
        for row in rows:
            subdomains.append(row['fully_qualified_subdomain'])

        return subdomains