<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_timestamp, end_timestamp):
 """ Return a new TimeSeries object contains all the timstamps and values within the specified range. :param int start_timestamp: the start timestamp value :param int end_timestamp: the end timestamp value :return: :class:`TimeSeries` object. """

        output = {}
        for key, value in self.items():
            if key >= start_timestamp and key <= end_timestamp:
                output[key] = value

        if output:
            return TimeSeries(output)
        else:
            raise ValueError('TimeSeries data was empty or invalid.')