<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def crop(self, start=None, end=None, copy=False):
 """Crop this series to the given x-axis extent. Parameters start : `float`, optional lower limit of x-axis to crop to, defaults to current `~Series.x0` end : `float`, optional upper limit of x-axis to crop to, defaults to current series end copy : `bool`, optional, default: `False` copy the input data to fresh memory, otherwise return a view Returns ------- series : `Series` A new series with a sub-set of the input data Notes ----- If either ``start`` or ``end`` are outside of the original `Series` span, warnings will be printed and the limits will be restricted to the :attr:`~Series.xspan` """

        x0, x1 = self.xspan
        xtype = type(x0)
        if isinstance(start, Quantity):
            start = start.to(self.xunit).value
        if isinstance(end, Quantity):
            end = end.to(self.xunit).value

        # pin early starts to time-series start
        if start == x0:
            start = None
        elif start is not None and xtype(start) < x0:
            warn('%s.crop given start smaller than current start, '
                 'crop will begin when the Series actually starts.'
                 % type(self).__name__)
            start = None

        # pin late ends to time-series end
        if end == x1:
            end = None
        if end is not None and xtype(end) > x1:
            warn('%s.crop given end larger than current end, '
                 'crop will end when the Series actually ends.'
                 % type(self).__name__)
            end = None

        # find start index
        if start is None:
            idx0 = None
        else:
            idx0 = int((xtype(start) - x0) // self.dx.value)

        # find end index
        if end is None:
            idx1 = None
        else:
            idx1 = int((xtype(end) - x0) // self.dx.value)
            if idx1 >= self.size:
                idx1 = None

        # crop
        if copy:
            return self[idx0:idx1].copy()
        return self[idx0:idx1]