code: def last_child(self):
          
          return self.children.filter(
              PIDRelation.index.isnot(None)).ordered().first()
docs: Get the latest PID as pointed by the Head PID.
  
          If the 'pid' is a Head PID, return the latest of its children.
          If the 'pid' is a Version PID, return the latest of its siblings.
          Return None for the non-versioned PIDs.