def to_time_weighted(G, speed):
    """
    Convert from distance weighted network to time weighted network.

    Parameters
    ----------
    :param G: networkx.MultiDiGraph
        transport network with length attribute.
    :param speed: float
        speed in Km/h.

    Parameters
    ----------
    :return: networkx.MultiDiGraph
        time-weighted network
    """
    for u, v, key, data in G.edges(data='length', keys=True):
        ujt = 1 / (speed * 16.666666667)  # turn km/h to min/meter
        G[u][v][key]['weight'] = data * ujt

    return G