code: def get_movielens_item_metadata(use_item_ids):
      
  
      features = {}
      genre_set = set()
  
      for line in _get_movie_raw_metadata():
  
          if not line:
              continue
  
          splt = line.split('|')
          item_id = int(splt[0])
  
          genres = [idx for idx, val in
                    zip(range(len(splt[5:])), splt[5:])
                    if int(val) > 0]
  
          if use_item_ids:
              # Add item-specific features too
              genres.append(item_id)
  
          for genre_id in genres:
              genre_set.add(genre_id)
  
          features[item_id] = genres
  
      mat = sp.lil_matrix((len(features) + 1,
                           len(genre_set)),
                          dtype=np.int32)
  
      for item_id, genre_ids in features.items():
          for genre_id in genre_ids:
              mat[item_id, genre_id] = 1
  
      return mat
docs: Build a matrix of genre features (no_items, no_features).
  
      If use_item_ids is True, per-item features will also be used.