def _translate_ocsp_query(cert_path, ocsp_output, ocsp_errors):
 states = ('good', 'revoked', 'unknown')
 patterns = ['{0}: (WARNING.*)?{1}'.format(cert_path, s) for s in states]
 (good, revoked, unknown) = (re.search(p, ocsp_output, flags=re.DOTALL) for p in patterns)
 warning = (good.group(1) if good else None)
 if ((not ('Response verify OK' in ocsp_errors)) or (good and warning) or unknown):
  logger.info('Revocation status for %s is unknown', cert_path)
  logger.debug('Uncertain output:\n%s\nstderr:\n%s', ocsp_output, ocsp_errors)
  return False
 elif (good and (not warning)):
  return False
 elif revoked:
  warning = revoked.group(1)
  if warning:
   logger.info('OCSP revocation warning: %s', warning)
  return True
 else:
  logger.warn('Unable to properly parse OCSP output: %s\nstderr:%s', ocsp_output, ocsp_errors)
  return False

def _translate_ocsp_query ( cert_path , ocsp_output , ocsp_errors ) : states = ( 'good' , 'revoked' , 'unknown' ) patterns = [ '{0}: (WARNING.*)?{1}' . format ( cert_path , s ) for s in states ] ( good , revoked , unknown ) = ( re . search ( p , ocsp_output , flags = re . DOTALL ) for p in patterns ) warning = ( good . group ( 1 ) if good else None ) if ( ( not ( 'Response verify OK' in ocsp_errors ) ) or ( good and warning ) or unknown ) : logger . info ( 'Revocation status for %s is unknown' , cert_path ) logger . debug ( 'Uncertain output:\n%s\nstderr:\n%s' , ocsp_output , ocsp_errors ) return False elif ( good and ( not warning ) ) : return False elif revoked : warning = revoked . group ( 1 ) if warning : logger . info ( 'OCSP revocation warning: %s' , warning ) return True else : logger . warn ( 'Unable to properly parse OCSP output: %s\nstderr:%s' , ocsp_output , ocsp_errors ) return False
parse openssls weird output to work out what it means .