I have this python script in AWS that automatically creates snapshot backups for me. I need to convert it from Python 2.7 to Python 3.8 and have updated the "Print" ('function') already as per other research, but can't find out why it still doesn't work.

It's work that I copied and pasted originally. I do not know python code :) :( 

Any help is greatly appreciated.

```
    import boto3
    import collections
    import datetime

    ec = boto3.client('ec2')

    def lambda_handler(event, context):
        reservations = ec.describe_instances(
            Filters=[
                {'Name': 'tag-key', 'Values': ['backup', 'Backup']},
            ]
        ).get(
            'Reservations', []
        )

        instances = [
            i for r in reservations
            for i in r['Instances']
        ]

        print ('Found %d instances that need backing up') % len(instances)

        to_tag = collections.defaultdict(list)

        for instance in instances:
            try:
                retention_days = [
                    int(t.get('Value')) for t in instance['Tags']
                    if t['Key'] == 'Snap-Retention'][0]
            except IndexError:
                retention_days = 2

            for dev in instance['BlockDeviceMappings']:
                if dev.get('Ebs', None) is None:
                    continue
                vol_id = dev['Ebs']['VolumeId']
                print ("Found EBS volume %s on instance %s") % (
                    vol_id, instance['InstanceId'])

                snap = ec.create_snapshot(
                    VolumeId=vol_id,
                )

                to_tag[retention_days].append(snap['SnapshotId'])

                print ('Retaining snapshot %s of volume %s from instance %s for %d days') % (
                    snap['SnapshotId'],
                    vol_id,
                    instance['InstanceId'],
                    retention_days,
                )

        for retention_days in to_tag.keys():
            delete_date = datetime.date.today() + datetime.timedelta(days=retention_days)
            delete_fmt = delete_date.strftime('%Y-%m-%d')
            print ('Will delete %d snapshots on %s') % (len(to_tag[retention_days]), delete_fmt)
            ec.create_tags(
                Resources=to_tag[retention_days],
                Tags=[
                    {'Key': 'DeleteOn', 'Value': delete_fmt},
                ]
            )

```

The error:
[ERROR] TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'
Traceback (most recent call last):
File "/var/task/lambda\_function.py", line 21, in lambda\_handler
print ('Found %d instances that need backing up') % len(instances)