code: def get_actor_blueprints(world, filter, generation):
      bps = world.get_blueprint_library().filter(filter)
  
      if generation.lower() == "all":
          return bps
  
      # If the filter returns only one bp, we assume that this one needed
      # and therefore, we ignore the generation
      if len(bps) == 1:
          return bps
  
      try:
          int_generation = int(generation)
          # Check if generation is in available generations
          if int_generation in [1, 2, 3]:
              bps = [
                  x
                  for x in bps
                  if int(x.get_attribute("generation"))
                  == int_generation
              ]
              return bps
          else:
              print(
                  "   Warning! Actor Generation is not valid. No actor will be spawned."
              )
              return []
      except:
          print(
              "   Warning! Actor Generation is not valid. No actor will be spawned."
          )
          return []
  
file_path: carla/PythonAPI/examples/generate_traffic.py
imports: import glob
  import os
  import sys
  import time
  import carla
  from carla import VehicleLightState
  import argparse
  import logging
  from numpy import random
label_desc: Use image node_id 1 for calling a global function with example usage: get_actor_blueprints(world, filter, generation) and returns: bps, bps, bps, list, list