code: def choose_devices(target_abi, target_ids):
      device_clazz = device_class(target_abi)
      devices = device_clazz.list_devices()
  
      if target_ids == "all":
          run_devices = devices
      elif target_ids == "random":
          unlocked_devices = [
              dev for dev in devices if not util.is_device_locked(dev)
          ]
          if unlocked_devices:
              run_devices = [random.choice(unlocked_devices)]
          else:
              run_devices = [random.choice(devices)]
      else:
          device_id_list = [
              dev.strip() for dev in target_ids.split(",")
          ]
          run_devices = [
              dev for dev in device_id_list if dev in devices
          ]
  
      return run_devices
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import os
  import re
  import subprocess
  import random
  import tempfile
  from utils import util
label_desc: Use image node_id 4 for calling a global function with example usage: choose_devices(target_abi, target_ids) and returns: run_devices