Get the whois-related info for a name (not a subdomain).
        Optionally include the history.
        Return {'status': True, 'record': rec} on success
        Return {'error': ...} on error

def get_name_record(self, name, include_expired=False, include_history=False):
        """
        Get the whois-related info for a name (not a subdomain).
        Optionally include the history.
        Return {'status': True, 'record': rec} on success
        Return {'error': ...} on error
        """
        if not check_name(name):
            return {'error': 'invalid name', 'http_status': 400}
        
        name = str(name)

        db = get_db_state(self.working_dir)
        name_record = db.get_name(str(name), include_expired=include_expired, include_history=include_history)

        if name_record is None:
            db.close()
            return {"error": "Not found.", 'http_status': 404}

        else:
            assert 'opcode' in name_record, 'BUG: missing opcode in {}'.format(json.dumps(name_record, sort_keys=True))
            name_record = self.load_name_info(db, name_record)
            db.close()

            # also get the subdomain resolver 
            resolver = get_subdomain_resolver(name)
            name_record['resolver'] = resolver
            return {'status': True, 'record': name_record}