text: from json import load, dumps
  
  
  def should_append(version):
      return version == 'USUM' or version == 'SM'
  
  
  def format_version(version):
      return 'updated-alola' if version == 'USUM' else 'alola' if version == 'SM' else ''
  
  
  with open('resources/pokemon_locations.json', 'r') as f:
      json_file = load(f)
  
  pokemon_dictionary = {}
  for item in json_file:
      item_name = item['name']
      item_location = item['locations']
      my_locations = []
      for location in item_location.keys():
          if should_append(location):
              my_locations.append({'entryNumber': item_location[location], 'pokedex': format_version(location)})
  
      pokemon_dictionary[item_name] = my_locations
  
  with open('resources/pokemon-master.json', 'r') as f:
      json_file = load(f)
  
  array = []
  
  for item in json_file:
      name = item['name']
      if name in pokemon_dictionary:
          indices = item['pokedexNumbers']
          indices = indices + pokemon_dictionary[name]
          item['pokedexNumbers'] = indices
      del item['gameIndices']
      array.append(item)
  
  with open('pokemon.json', 'w') as f:
      f.write(dumps(array))
  