code: def restrict_to_parent(self, target, parent):
          
          if not (parent['start'] < target < parent['end']):
              target = parent['end']
          return target
docs: Restrict target to parent structure boundaries.