code: def get_ref_chain(self, ref_limit=100):
          
          head = self
          ref_chain = set()
          while len(ref_chain) < ref_limit:
              if isinstance(head, Dataset):
                  ref_chain.add(head)
                  if (head.reference is not None) and (head.reference not in ref_chain):
                      head = head.reference
                  else:
                      break
              else:
                  break
          return ref_chain
docs: Get a chain of Dataset objects.
  
          Starts with r, then goes to r.reference (if exists),
          then to r.reference.reference, etc.
          until we hit ``ref_limit`` or a reference loop.
  
          Parameters
          ----------
          ref_limit : int, optional (default=100)
              The limit number of references.
  
          Returns
          -------
          ref_chain : set of Dataset
              Chain of references of the Datasets.