class_docstr: Helper base class for the :class:`Domain` and :class:`Sample` classes.
  
  It implements common logic for creation, representation, type conversion
  and serialisation.
class_docstr_tok: ["Helper","base","class","for","the",":","class",":","`","Domain","`","and",":","class",":","`","Sample","`","classes",".","It","implements","common","logic","for","creation",",","representation",",","type","conversion","and","serialisation","."]
docstr: Convert a :class:`_RecursiveDict` to a namedtuple type.
  
  Returns:
      A Python namedtuple object with names the same as the keys of the
      :class:`_RecursiveDict` dict. Nested dicts are accessed by
      successive attribute getters.
  
  Examples:
  ```python
      >>> rd = _RecursiveDict({"a": {"b": [1, 2]}, "c": {1, 2, 3}, "d": 2.})
      >>> nt = rd.as_namedtuple()
      >>> nt.a.b
      [1, 2]
      >>> nt.c == {1, 2, 3} and nt.d == 2.
      True
  ```
docstr_tok: ["Convert","a",":","class",":","`","_RecursiveDict","`","to","a","namedtuple","type",".","Returns",":","A","Python","namedtuple","object","with","names","the","same","as","the","keys","of","the",":","class",":","`","_RecursiveDict","`","dict",".","Nested","dicts","are","accessed","by","successive","attribute","getters",".","Examples",":","``","`","python",">",">",">","rd","=","_RecursiveDict","(","{","``","a","''",":","{","``","b","''",":","[","1",",","2","]","}",",","``","c","''",":","{","1",",","2",",","3","}",",","``","d","''",":","2",".","}",")",">",">",">","nt","=","rd.as_namedtuple","(",")",">",">",">","nt.a.b","[","1",",","2","]",">",">",">","nt.c","==","{","1",",","2",",","3","}","and","nt.d","==","2",".","True","``","`"]
code: def as_namedtuple(self):
      """Convert a :class:`_RecursiveDict` to a namedtuple type.
  
      Returns:
          A Python namedtuple object with names the same as the keys of the
          :class:`_RecursiveDict` dict. Nested dicts are accessed by
          successive attribute getters.
  
      Examples:
      ```python
          >>> rd = _RecursiveDict({"a": {"b": [1, 2]}, "c": {1, 2, 3}, "d": 2.})
          >>> nt = rd.as_namedtuple()
          >>> nt.a.b
          [1, 2]
          >>> nt.c == {1, 2, 3} and nt.d == 2.
          True
      ```
      """
  
      def helper(dct):
          keys, vals = [], []
          for k, v in dct.items():
              keys.append(k)
              if isinstance(v, dict):
                  vals.append(helper(v))
              else:
                  vals.append(v)
          # The dict.keys() and dict.values() will iterate in the same order
          # as long as dct is not modified.
          return namedtuple("NT_" + self.__class__.__name__, keys)(
              *vals
          )
  
      return helper(self._data)
  
imports: import ast
  import copy
  import os
  import pickle
  import random
  from collections import namedtuple
  from typing import Tuple
label_desc: Use image node_id 14 for calling the _RecursiveDict obj's underlying member method code with example usage: obj.as_namedtuple() and returns: helper, namedtuple