code: def get_subdomain_entry(self, fqn, accepted=True, cur=None):
          
          get_cmd = "SELECT * FROM {} WHERE fully_qualified_subdomain=? {} ORDER BY sequence DESC, parent_zonefile_index DESC LIMIT 1;".format(self.subdomain_table, 'AND accepted=1' if accepted else '')
          cursor = None
          if cur is None:
              cursor = self.conn.cursor()
          else:
              cursor = cur
  
          db_query_execute(cursor, get_cmd, (fqn,))
  
          try:
              rowdata = cursor.fetchone()
              assert rowdata
          except Exception as e:
              raise SubdomainNotFound(fqn)
  
          return self._extract_subdomain(rowdata)
docs: Given a fully-qualified subdomain, get its (latest) subdomain record.
          Raises SubdomainNotFound if there is no such subdomain