<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def handle_machines(changeset):
 """Populate the change set with addMachines changes."""

    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