def get_ring(gossip):
  """ Return the ring status in a structured way.

  Args:
    gossip: A list of gossip info for each node.

  Returns:
    A list of nodes represented by dictionaries.
  """
  nodes = sorted(gossip, key=lambda node: node['token'])
  for index, node in enumerate(nodes):
    node['index'] = index

  if not nodes:
    raise Exception('Unable to find nodes in ring')

  # Calculate skew and diff for each node in ring.
  ideal_load = sum(node['load'] for node in nodes) / len(nodes)
  for index, node in enumerate(nodes):
    try:
      node['skew'] = abs(node['load'] - ideal_load) / ideal_load
    except ZeroDivisionError:
      node['skew'] = 0

    node['diff'] = abs(node['load'] - nodes[index - 1]['load'])

  return nodes