code: def _check_child_limits(self, child_pid):
          
          if self.max_children is not None and \
                  self.children.count() >= self.max_children:
              raise PIDRelationConsistencyError(
                  "Max number of children is set to {}.".
                  format(self.max_children))
          if self.max_parents is not None and \
                  PIDRelation.query.filter_by(
                      child=child_pid,
                      relation_type=self.relation_type.id)\
                  .count() >= self.max_parents:
              raise PIDRelationConsistencyError(
                  "This pid already has the maximum number of parents.")
docs: Check that inserting a child is within the limits.