<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_py_units(data):
 """Generate the list of units in units.py."""

  units = collections.defaultdict(list)
  for unit in sorted(data.units, key=lambda a: a.name):
    if unit.unit_id in static_data.UNIT_TYPES:
      units[unit.race].append(unit)

  def print_race(name, race):
    print("class %s(enum.IntEnum):" % name)
    print('  """%s units."""' % name)
    for unit in units[race]:
      print("  %s = %s" % (unit.name, unit.unit_id))
    print("\n")

  print_race("Neutral", sc_common.NoRace)
  print_race("Protoss", sc_common.Protoss)
  print_race("Terran", sc_common.Terran)
  print_race("Zerg", sc_common.Zerg)