<s> """<STR_LIT>""" <EOL> from googlemaps import convert <EOL> def directions ( client , origin , destination , <EOL> mode = None , waypoints = None , alternatives = False , avoid = None , <EOL> language = None , units = None , region = None , departure_time = None , <EOL> arrival_time = None , optimize_waypoints = False , transit_mode = None , <EOL> transit_routing_preference = None , traffic_model = None ) : <EOL> """<STR_LIT>""" <EOL> params = { <EOL> "<STR_LIT>" : convert . latlng ( origin ) , <EOL> "<STR_LIT>" : convert . latlng ( destination ) <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 waypoints : <EOL> waypoints = convert . location_list ( waypoints ) <EOL> if optimize_waypoints : <EOL> waypoints = "<STR_LIT>" + waypoints <EOL> params [ "<STR_LIT>" ] = waypoints <EOL> if alternatives : <EOL> params [ "<STR_LIT>" ] = "<STR_LIT:true>" <EOL> if avoid : <EOL> params [ "<STR_LIT>" ] = convert . join_list ( "<STR_LIT:|>" , avoid ) <EOL> if language : <EOL> params [ "<STR_LIT>" ] = language <EOL> if units : <EOL> params [ "<STR_LIT>" ] = units <EOL> if region : <EOL> params [ "<STR_LIT>" ] = region <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 ) [ "<STR_LIT>" ] </s>
