def is_wr_a_valid_divertion_from_node(wr, node_id, wr_ids):
  """
  Evaluates if the way relation `wr` is a valid divertion from node with id `node_id`.
  A valid divertion is a way relation with an edge node with the given `node_id` that is not already included
  in the list of way relations in the route (`wr_ids`) and that can be travaled in the direction as if starting 
  from node with id `node_id`
  """
  if wr.id in wr_ids:
    return False
  wr.update_direction_from_starting_node(node_id)
  return not wr.is_prohibited