def METHOD_NAME(dataset):
  """Creates an iterator, and initializes tables.
  This is useful in cases where make_one_shot_iterator wouldn't work because
  the graph contains a hash table that needs to be initialized.
  Args:
    dataset: A `tf.data.Dataset` object.
  Returns:
    A `tf.data.Iterator`.
  """
  iterator = tf.compat.v1.data.METHOD_NAME(dataset)
  tf.compat.v1.add_to_collection(tf.compat.v1.GraphKeys.TABLE_INITIALIZERS, iterator.initializer)
  return iterator