'Use the \'ansible_ec2_placement_availability_zone\' key/value
pair to add \'ansible_ec2_placement_region\' key/value pair with
the EC2 region name.'

def add_ec2_region(self, data):

    zone = data.get('ansible_ec2_placement_availability_zone')
    if (zone is not None):
        region = zone
        for r in self.AWS_REGIONS:
            if zone.startswith(r):
                region = r
                break
        data['ansible_ec2_placement_region'] = region
