<s> """<STR_LIT>""" <EOL> from googlemaps import convert <EOL> from googlemaps . convert import as_list <EOL> def distance_matrix ( client , origins , destinations , <EOL> mode = None , language = None , avoid = None , units = None , <EOL> departure_time = None , arrival_time = None , transit_mode = None , <EOL> transit_routing_preference = None , traffic_model = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> "<STR_LIT>" : convert . location_list ( origins ) , <EOL> "<STR_LIT>" : convert . location_list ( destinations ) <EOL> } <EOL> if mode : <EOL> if mode not in [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> params [ "<STR_LIT>" ] = mode <EOL> if language : <EOL> params [ "<STR_LIT>" ] = language <EOL> if avoid : <EOL> if avoid not in [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> params [ "<STR_LIT>" ] = avoid <EOL> if units : <EOL> params [ "<STR_LIT>" ] = units <EOL> if departure_time : <EOL> params [ "<STR_LIT>" ] = convert . time ( departure_time ) <EOL> if arrival_time : <EOL> params [ "<STR_LIT>" ] = convert . time ( arrival_time ) <EOL> if departure_time and arrival_time : <EOL> raise ValueError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if transit_mode : <EOL> params [ "<STR_LIT>" ] = convert . join_list ( "<STR_LIT:|>" , transit_mode ) <EOL> if transit_routing_preference : <EOL> params [ "<STR_LIT>" ] = transit_routing_preference <EOL> if traffic_model : <EOL> params [ "<STR_LIT>" ] = traffic_model <EOL> return client . _get ( "<STR_LIT>" , params ) </s>
