<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sprints(self, board_id, extended=False, startAt=0, maxResults=50, state=None):
 """Get a list of sprint GreenHopperResources. :param board_id: the board to get sprints from :param extended: Used only by old GreenHopper API to fetch additional information like startDate, endDate, completeDate, much slower because it requires an additional requests for each sprint. New JIRA Agile API always returns this information without a need for additional requests. :param startAt: the index of the first sprint to return (0 based) :param maxResults: the maximum number of sprints to return :param state: Filters results to sprints in specified states. Valid values: `future`, `active`, `closed`. You can define multiple states separated by commas :type board_id: int :type extended: bool :type startAt: int :type maxResults: int :type state: str :rtype: list of :class:`~jira.resources.Sprint` :return: (content depends on API version, but always contains id, name, state, startDate and endDate) When old GreenHopper private API is used, paging is not enabled, and `startAt`, `maxResults` and `state` parameters are ignored. """

        params = {}
        if state:
            params['state'] = state

        if self._options['agile_rest_path'] == GreenHopperResource.GREENHOPPER_REST_PATH:
            r_json = self._get_json('sprintquery/%s?includeHistoricSprints=true&includeFutureSprints=true' % board_id,
                                    base=self.AGILE_BASE_URL)

            if params:
                warnings.warn('Old private GreenHopper API is used, parameters %s will be ignored.' % params, Warning)

            if extended:
                sprints = [Sprint(self._options, self._session, self.sprint_info(None, raw_sprints_json['id']))
                           for raw_sprints_json in r_json['sprints']]
            else:
                sprints = [Sprint(self._options, self._session, raw_sprints_json)
                           for raw_sprints_json in r_json['sprints']]

            return ResultList(sprints, 0, len(sprints), len(sprints), True)
        else:
            return self._fetch_pages(Sprint, 'values', 'board/%s/sprint' % board_id, startAt, maxResults, params,
                                     self.AGILE_BASE_URL)