'This is the lowest level paging logic for fetching IDs. It is used
solely by GetFollowerIDsPaged and GetFriendIDsPaged. It is not intended
for other use.
See GetFollowerIDsPaged or GetFriendIDsPaged for an explanation of the
input arguments.'

def _GetIDsPaged(self, url, user_id, screen_name, cursor, stringify_ids, count):

    result = []
    parameters = {}
    if (user_id is not None):
        parameters['user_id'] = user_id
    if (screen_name is not None):
        parameters['screen_name'] = screen_name
    if (count is not None):
        parameters['count'] = count
    parameters['stringify_ids'] = stringify_ids
    parameters['cursor'] = cursor
    resp = self._RequestUrl(url, 'GET', data=parameters)
    data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
    if ('ids' in data):
        result.extend([x for x in data['ids']])
    next_cursor = data.get('next_cursor', 0)
    previous_cursor = data.get('previous_cursor', 0)
    return (next_cursor, previous_cursor, result)
