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: Serialise the :class:`_RecursiveDict` object to a file or a string
  if `filepath` is not supplied.
  
  Args:
      filepath: (optional) :obj:`str`. Filepath as to dump the serialised
      :class:`_RecursiveDict` object.
  
  Returns:
      The bytes representing the serialised :class:`_RecursiveDict` object.
docstr_tok: ["Serialise","the",":","class",":","`","_RecursiveDict","`","object","to","a","file","or","a","string","if","`","filepath","`","is","not","supplied",".","Args",":","filepath",":","(","optional",")",":","obj",":","`","str","`",".","Filepath","as","to","dump","the","serialised",":","class",":","`","_RecursiveDict","`","object",".","Returns",":","The","bytes","representing","the","serialised",":","class",":","`","_RecursiveDict","`","object","."]
code: def serialise(self, filepath=None):
      """Serialise the :class:`_RecursiveDict` object to a file or a string
      if `filepath` is not supplied.
  
      Args:
          filepath: (optional) :obj:`str`. Filepath as to dump the serialised
          :class:`_RecursiveDict` object.
  
      Returns:
          The bytes representing the serialised :class:`_RecursiveDict` object.
      """
      serialised = pickle.dumps(self._data)
      if filepath is not None:
          with open(filepath, "wb") as fp:
              pickle.dump(self._data, fp)
      return serialised
  
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 12 for calling the _RecursiveDict obj's underlying member method code with example usage: obj.serialise(filepath) and returns: serialised