<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def floyd_warshall(weight):
 """All pairs shortest paths by Floyd-Warshall :param weight: edge weight matrix :modifies: weight matrix to contain distances in graph :returns: True if there are negative cycles :complexity: :math:`O(|V|^3)` """

    V = range(len(weight))
    for k in V:
        for u in V:
            for v in V:
                weight[u][v] = min(weight[u][v],
                                   weight[u][k] + weight[k][v])
    for v in V:
        if weight[v][v] < 0:      # negative cycle found
            return True
    return False