def _entity_paginator(namespace, workspace, etype, page_size=<NUM_LIT>,<EOL>filter_terms=None, sort_direction="<STR_LIT>"):
page = <NUM_LIT:1><EOL>all_entities = []<EOL>r = fapi.get_entities_query(namespace, workspace, etype, page=page,<EOL>page_size=page_size, sort_direction=sort_direction,<EOL>filter_terms=filter_terms)<EOL>fapi._check_response_code(r, <NUM_LIT:200>)<EOL>response_body = r.json()<EOL>total_pages = response_body['<STR_LIT>']['<STR_LIT>']<EOL>entities = response_body['<STR_LIT>']<EOL>all_entities.extend(entities)<EOL>page = <NUM_LIT:2><EOL>while page <= total_pages:<EOL><INDENT>r = fapi.get_entities_query(namespace, workspace, etype, page=page,<EOL>page_size=page_size, sort_direction=sort_direction,<EOL>filter_terms=filter_terms)<EOL>fapi._check_response_code(r, <NUM_LIT:200>)<EOL>entities = r.json()['<STR_LIT>']<EOL>all_entities.extend(entities)<EOL>page += <NUM_LIT:1><EOL><DEDENT>return all_entities<EOL>
Pages through the get_entities_query endpoint to get all entities in
       the workspace without crashing.