def _notAfterBefore(cert_path, method):
 with open(cert_path) as f:
  x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, f.read())
 timestamp = method(x509)
 reformatted_timestamp = [timestamp[0:4], '-', timestamp[4:6], '-', timestamp[6:8], 'T', timestamp[8:10], ':', timestamp[10:12], ':', timestamp[12:]]
 timestamp_str = ''.join(reformatted_timestamp)
 if six.PY3:
  timestamp_str = timestamp_str.decode('ascii')
 return pyrfc3339.parse(timestamp_str)

def _notAfterBefore ( cert_path , method ) : with open ( cert_path ) as f : x509 = OpenSSL . crypto . load_certificate ( OpenSSL . crypto . FILETYPE_PEM , f . read ( ) ) timestamp = method ( x509 ) reformatted_timestamp = [ timestamp [ 0 : 4 ] , '-' , timestamp [ 4 : 6 ] , '-' , timestamp [ 6 : 8 ] , 'T' , timestamp [ 8 : 10 ] , ':' , timestamp [ 10 : 12 ] , ':' , timestamp [ 12 : ] ] timestamp_str = '' . join ( reformatted_timestamp ) if six . PY3 : timestamp_str = timestamp_str . decode ( 'ascii' ) return pyrfc3339 . parse ( timestamp_str )
internal helper function for finding notbefore/notafter .