ensures data is properly subset to the range in range_obj.
        (Depending on how the chunking is implemented, it might be possible
        to specify a chunk range that reads out more than the actual range
        eg: date range, chunked monthly. read out 2016-01-01 to 2016-01-02.
        This will read ALL of January 2016 but it should be subset to just
        the first two days)

        returns
        -------
        data, filtered by range_obj

def filter(self, data, range_obj):
        """
        ensures data is properly subset to the range in range_obj.
        (Depending on how the chunking is implemented, it might be possible
        to specify a chunk range that reads out more than the actual range
        eg: date range, chunked monthly. read out 2016-01-01 to 2016-01-02.
        This will read ALL of January 2016 but it should be subset to just
        the first two days)

        returns
        -------
        data, filtered by range_obj
        """
        if isinstance(range_obj, (pd.DatetimeIndex, tuple)):
            range_obj = DateRange(range_obj[0], range_obj[-1])

        range_obj = to_pandas_closed_closed(range_obj, add_tz=False)
        start = range_obj.start
        end = range_obj.end

        if 'date' in data.index.names:
            return data[start:end]
        elif 'date' in data.columns:
            if start and end:
                return data[(data.date >= start) & (data.date <= end)]
            elif start:
                return data[(data.date >= start)]
            elif end:
                return data[(data.date <= end)]
            else:
                return data
        else:
            return data