def METHOD_NAME(args, pacu_main):
    session = pacu_main.get_active_session()
    ###### Don't modify these. They can be removed if you are not using the function.
    args = parser.parse_args(args)
    print = pacu_main.print
    fetch_data = pacu_main.fetch_data
    get_regions = pacu_main.get_regions
    ######
    regions = get_regions('ec2')
    client = pacu_main.get_boto3_client('ec2', random.choice(regions))
    instances = []
    if args.instance_ids is not None:  # need to update this to include the regions of these IDs
        for instance in args.instance_ids.split(','):
            if "@" not in instance:
                print("Usage: <instance-id>@<region>   ex: i-abcdef12345@us-west-2")
                return({"error": "invalid usage"})
            instances.append({
                'InstanceId': instance.split('@')[0],
                'Region': instance.split('@')[1]
            })
    else:
        print('Targeting all EC2 instances...')
        if fetch_data(['EC2', 'Instances'], module_info['prerequisite_modules'][0], '--instances') is False:
            print('Sub-module run failed')
            return
        for instance in session.EC2['Instances']:
            instances.append({
                'InstanceId': instance['InstanceId'],
                'Region': instance['Region']
            })
    instance_count = 0
    for region in regions:
        client = pacu_main.get_boto3_client('ec2', region)
        for instance in instances:
            if instance['Region'] == region:
                result = stop_instance(client, instance['InstanceId'], print)
                if result:
                    update_userdata(client, instance['InstanceId'], prepare_user_data(client, instance['InstanceId'], args.script), print)
                    start_instance(client, instance['InstanceId'], print)
                    instance_count += 1
                else:
                    print('  {}@{} FAILED'.format(instance['InstanceId'], instance['Region']))
    return {'Instances': instance_count}