def epsilon_closure(state):
  """
  Return the set of states reachable from the given state
  by epsilon moves.
  """
  # Cache the result
  result = state.epsilon_closure
  if result is None:
    result = {}
    state.epsilon_closure = result
    add_to_epsilon_closure(result, state)
  return result