#NEWLINE# def _filter_test_runs_by_date( query , start_date = None , stop_date = None ) : #NEWLINE# #INDENT# if isinstance ( start_date , str ) : #NEWLINE# #INDENT# start_date = datetime . datetime . strptime ( start_date , '%Y-%m-%d' ) #NEWLINE# #UNINDENT# if isinstance ( stop_date , str ) : #NEWLINE# #INDENT# stop_date = datetime . datetime . strptime ( stop_date , '%Y-%m-%d' ) #NEWLINE# #UNINDENT# if start_date : #NEWLINE# #INDENT# query = query . filter ( ( models . TestRun . start_time >= start_date ) ) #NEWLINE# #UNINDENT# if stop_date : #NEWLINE# #INDENT# query = query . filter ( ( models . TestRun . start_time <= stop_date ) ) #NEWLINE# #UNINDENT# return query