def service_list(service=None, key_name=None, **kwargs):
resp_list = []<EOL>req = service.list(**kwargs)<EOL>while req is not None:<EOL><INDENT>resp = req.execute()<EOL>if key_name and key_name in resp:<EOL><INDENT>resp_list.extend(resp[key_name])<EOL><DEDENT>else:<EOL><INDENT>resp_list.append(resp)<EOL><DEDENT>if hasattr(service, '<STR_LIT>'):<EOL><INDENT>req = service.list_next(previous_request=req,<EOL>previous_response=resp)<EOL><DEDENT>else:<EOL><INDENT>req = None<EOL><DEDENT><DEDENT>return resp_list<EOL>
General list function for Google APIs.