#NEWLINE# def randr_value( location_id , start_date , end_date ) : #NEWLINE# #INDENT# latest_submit = latest_status_or_none ( location_id , SupplyPointStatusTypes . R_AND_R_FACILITY , start_date , end_date , value = SupplyPointStatusValues . SUBMITTED ) #NEWLINE# if latest_submit : #NEWLINE# #INDENT# return ( True , latest_submit . status_date ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# latest_not_submit = latest_status_or_none ( location_id , SupplyPointStatusTypes . R_AND_R_FACILITY , start_date , start_date , value = SupplyPointStatusValues . NOT_SUBMITTED ) #NEWLINE# return ( False , ( latest_not_submit . status_date if latest_not_submit else None ) )