code: def parse_1m_movies_data(
      dir_path: str,
  ) -> Iterator[Tuple[int, Dict[str, Any]]]:
      """Parses the 1m movies data."""
      movies_file_path = os.path.join(dir_path, "movies.dat")
      with tf.io.gfile.GFile(
          movies_file_path, mode="rb"
      ) as movies_file:
          for row_num, line in enumerate(movies_file):
              line = codecs.decode(line, encoding="ISO-8859-1").strip()
              # Row format: <movie id>::<movie title>::<movie genres>.
              movie_id, movie_title, movie_genres_str = line.split("::")
              genre_list = movie_genres_str.split("|")
              # 1m dataset labels "Children" genre as "Children's".
              # However "Children" and "Children's" should represent the same genre.
              for idx, genre in enumerate(genre_list):
                  if genre == "Children's":
                      genre_list[idx] = "Children"
              yield row_num, {
                  "movie_id": movie_id,
                  "movie_title": movie_title,
                  "movie_genres": genre_list,
              }
  
file_path: datasets/tensorflow_datasets/structured/movielens_parsing.py
imports: import codecs
  import csv
  import os
  from typing import Any, Dict, Iterator, Tuple
  from etils import epath
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: parse_1m_movies_data(dir_path) without return types