code: def _interpolated_template(self, templateid):
          
          phase, y = self._get_template_by_id(templateid)
  
          # double-check that phase ranges from 0 to 1
          assert phase.min() >= 0
          assert phase.max() <= 1
  
          # at the start and end points, we need to add ~5 points to make sure
          # the spline & derivatives wrap appropriately
          phase = np.concatenate([phase[-5:] - 1, phase, phase[:5] + 1])
          y = np.concatenate([y[-5:], y, y[:5]])
  
          # Univariate spline allows for derivatives; use this!
          return UnivariateSpline(phase, y, s=0, k=5)
docs: Return an interpolator for the given template