def _encoded_x_field(encoded_x, path):
  """Returns a field from `encoded_x` returned by the `encode` method.

  In order to test the correctness of encoding, we also need to access the
  encoded objects, which in turns depends on an implementation detail (the
  specific use of `nest.flatten_with_joined_string_paths`). This dependence is
  constrained to a single place in this utility.

  Args:
    encoded_x: The structure returned by the `encode` method.
    path: A list of keys corresponding to the path in the nested dictionary
      before it was flattened.

  Returns:
    A value from `encoded_x` corresponding to the `path`.
  """
  return encoded_x['/'.join(path)]