code: def iter_pages(
      pageable_resp: bindings.Paginated,
      pageable_attribute: str,
      max_page_size: Optional[int] = None,
  ) -> Iterator[bindings.Paginated]:
      """Creates an infinite generator from a pageable response.
  
      If the pageable response is exhausted, this method will return an empty response.
  
      Args:
          pageable_resp: A complete response that can be paginated
          pageable_attribute: The name of the field in the response that will be split up across
            pages when a response is paginated
          max_page_size: The maximum number of items to include in each page. If a request's params
            specify a limit that is larger than this (or no limit at all), the limit will be reduced
            to this value
      """
      offset = 0
      while True:
          page = page_of(
              complete_resp=pageable_resp,
              pageable_type=pageable_attribute,
              offset=offset,
              limit=max_page_size,
          )
          yield page
  
          assert page.pagination is not None
          assert page.pagination.endIndex is not None
          offset = page.pagination.endIndex
  
imports: import copy
  import json
  import pathlib
  from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Tuple, TypeVar
  import requests
  from determined.common.api import bindings
label_desc: Use image node_id 20 for calling a global function with example usage: iter_pages(pageable_resp, pageable_attribute, max_page_size) without return types