code: def handle_machines(changeset):
      
      machines = sorted(changeset.bundle.get('machines', {}).items())
      for machine_name, machine in machines:
          if machine is None:
              # We allow the machine value to be unset in the YAML.
              machine = {}
          record_id = 'addMachines-{}'.format(changeset.next_action())
          changeset.send({
              'id': record_id,
              'method': 'addMachines',
              'args': [
                  {
                      'series': machine.get('series', ''),
                      'constraints': machine.get('constraints', ''),
                  },
              ],
              'requires': [],
          })
          changeset.machines_added[str(machine_name)] = record_id
          if 'annotations' in machine:
              changeset.send({
                  'id': 'setAnnotations-{}'.format(changeset.next_action()),
                  'method': 'setAnnotations',
                  'args': [
                      '${}'.format(record_id),
                      'machine',
                      machine['annotations'],
                  ],
                  'requires': [record_id],
              })
      return handle_relations
docs: Populate the change set with addMachines changes.