#NEWLINE# @ staticmethod #NEWLINE# def _parse_date( date_str , tz ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# dt = datetime . strptime ( date_str . strip ( ) , '%m-%d-%Y %I:%M %p' ) #NEWLINE# return dt . replace ( tzinfo = tz ) . astimezone ( UTC ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# source = datetime . now ( UTC ) . astimezone ( tz ) #NEWLINE# ( dt , pt ) = parsedatetime . Calendar ( ) . parseDT ( date_str , tzinfo = tz , sourceTime = source ) #NEWLINE# if ( pt == 3 ) : #NEWLINE# #INDENT# return dt . astimezone ( UTC ) #NEWLINE# #UNINDENT# raise ValueError ( 'Could not parse date: {}' . format ( date_str ) )