def get_parents(source_this: SourceObject): pad_this = source_this.pad record_root = pad_this.get_root(alt=source_this.alt) records_parents = [] record_parent = record_root while True: records_parents.append(record_parent) if source_this.record.path == record_parent.path: break for record_child in record_parent.children: if source_this.is_child_of(record_child): record_parent = record_child break else: return None return records_parents