def check_assert(self, cmd, retries=<NUM_LIT:1>, pollrate=<NUM_LIT>, on_retry=None):
for try_num in range(<NUM_LIT:0>, retries):<EOL><INDENT>if try_num > <NUM_LIT:0>:<EOL><INDENT>self.logger.debug(<EOL>"<STR_LIT>".<EOL>format(try_num, pollrate, cmd))<EOL>time.sleep(pollrate)<EOL>if on_retry is not None:<EOL><INDENT>self.gather(on_retry)  <EOL><DEDENT><DEDENT>result, stdout, stderr = self.gather(cmd)<EOL>if result == SUCCESS:<EOL><INDENT>break<EOL><DEDENT><DEDENT>self.logger.debug("<STR_LIT>".format(result, try_num))<EOL>assertion.success(<EOL>result,<EOL>"<STR_LIT>".<EOL>format(pushd.Dir.getcwd(), cmd, stderr))<EOL>return stdout, stderr<EOL>
Run a command, logging (using gather) and raise an exception if the
return code of the command indicates failure.
Try the command multiple times if requested.

:param cmd <string|list>: A shell command
:param retries int: The number of times to try before declaring failure
:param pollrate int: how long to sleep between tries
:param on_retry <string|list>: A shell command to run before retrying a failure
:return: (stdout,stderr) if exit code is zero