'Iterate over the milestones on this repository.
:param str state: (optional), state of the milestones, accepted
values: (\'open\', \'closed\')
:param str sort: (optional), how to sort the milestones, accepted
values: (\'due_date\', \'completeness\')
:param str direction: (optional), direction to sort the milestones,
accepted values: (\'asc\', \'desc\')
:param int number: (optional), number of milestones to return.
Default: -1 returns all milestones
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of
:class:`Milestone <github3.issues.milestone.Milestone>`\ s'

def milestones(self, state=None, sort=None, direction=None, number=(-1), etag=None):

    url = self._build_url(u'milestones', base_url=self._api)
    accepted = {u'state': (u'open', u'closed', u'all'), u'sort': (u'due_date', u'completeness'), u'direction': (u'asc', u'desc')}
    params = {u'state': state, u'sort': sort, u'direction': direction}
    for (k, v) in list(params.items()):
        if (not (v and (v in accepted[k]))):
            del params[k]
    if (not params):
        params = None
    return self._iter(int(number), url, Milestone, params, etag)
