def add_walk_distances_to_db_python(gtfs, osm_path, cutoff_distance_m=<NUM_LIT:1000>):
if isinstance(gtfs, str):<EOL><INDENT>gtfs = GTFS(gtfs)<EOL><DEDENT>assert (isinstance(gtfs, GTFS))<EOL>print("<STR_LIT>")<EOL>walk_network = create_walk_network_from_osm(osm_path)<EOL>print("<STR_LIT>")<EOL>stop_I_to_nearest_osm_node, stop_I_to_nearest_osm_node_distance = match_stops_to_nodes(gtfs, walk_network)<EOL>transfers = gtfs.get_straight_line_transfer_distances()<EOL>from_I_to_to_stop_Is = {stop_I: set() for stop_I in stop_I_to_nearest_osm_node}<EOL>for transfer_tuple in transfers.itertuples():<EOL><INDENT>from_I = transfer_tuple.from_stop_I<EOL>to_I = transfer_tuple.to_stop_I<EOL>from_I_to_to_stop_Is[from_I].add(to_I)<EOL><DEDENT>print("<STR_LIT>")<EOL>for from_I, to_stop_Is in from_I_to_to_stop_Is.items():<EOL><INDENT>from_node = stop_I_to_nearest_osm_node[from_I]<EOL>from_dist = stop_I_to_nearest_osm_node_distance[from_I]<EOL>shortest_paths = networkx.single_source_dijkstra_path_length(walk_network,<EOL>from_node,<EOL>cutoff=cutoff_distance_m - from_dist,<EOL>weight="<STR_LIT>")<EOL>for to_I in to_stop_Is:<EOL><INDENT>to_distance = stop_I_to_nearest_osm_node_distance[to_I]<EOL>to_node = stop_I_to_nearest_osm_node[to_I]<EOL>osm_distance = shortest_paths.get(to_node, float('<STR_LIT>'))<EOL>total_distance = from_dist + osm_distance + to_distance<EOL>from_stop_I_transfers = transfers[transfers['<STR_LIT>'] == from_I]<EOL>straigth_distance = from_stop_I_transfers[from_stop_I_transfers["<STR_LIT>"] == to_I]["<STR_LIT:d>"].values[<NUM_LIT:0>]<EOL>assert (straigth_distance < total_distance + <NUM_LIT:2>)  <EOL>if total_distance <= cutoff_distance_m:<EOL><INDENT>gtfs.conn.execute("<STR_LIT>"<EOL>"<STR_LIT>" + str(int(total_distance)) +<EOL>"<STR_LIT>" + str(from_I) + "<STR_LIT>" + str(to_I))<EOL><DEDENT><DEDENT><DEDENT>gtfs.conn.commit()<EOL>
Computes the walk paths between stops, and updates these to the gtfs database.

Parameters
----------
gtfs: gtfspy.GTFS or str
    A GTFS object or a string representation.
osm_path: str
    path to the OpenStreetMap file
cutoff_distance_m: number
    maximum allowed distance in meters

Returns
-------
None

See Also
--------
gtfspy.calc_transfers
compute_walk_paths_java