code: def test_ancestor(maxlen, ancestors_level, datasizes):
      # Test multiple depth of ancestors
      # maxlen: max length of the buffer(s)
      # ancestors_level: The number of ancestors to use
      # datasizes: data sizes to append() to each buffer
      assert len(datasizes) == ancestors_level
      c0bebeefs = []
      buffers = []
      tmpdirs = []
  
      for level in range(ancestors_level):
          datasize = datasizes[level]
          tmp_dir = tempfile.TemporaryDirectory()
          tmpdirs.append(tmp_dir)
  
          if level == 0:
              anc = None
          else:
              anc = tmpdirs[level - 1].name
          buf = PersistentRandomAccessQueue(
              tmp_dir.name, maxlen, ancestor=anc
          )
          buffers.append(buf)
  
          for i in range(datasize):
              data = (0x42 + i, "c0bebeef")
              buf.append(data)
              c0bebeefs.append(data)
  
          c0bebeefs = c0bebeefs[-maxlen:]
          assert len(c0bebeefs) == len(buf)
  
          buf.close()
  
      for d in tmpdirs:
          d.cleanup()
  
imports: import tempfile
  import pytest
  from pfrl.collections.persistent_collections import PersistentRandomAccessQueue
label_desc: Use image node_id 4 for calling a global function with example usage: test_ancestor(maxlen, ancestors_level, datasizes) without return types