code: def allocate(self, dut_configuration_list, args=None):
          dut_config_list = dut_configuration_list.get_dut_configuration()
          if not isinstance(dut_config_list, list):
              raise AllocationError("Invalid dut configuration format!")
          if next((item for item in dut_config_list if item.get("type") == "hardware"), False):
              self._available_devices = DutDetection().get_available_devices()
              if len(self._available_devices) < len(dut_config_list):
                  raise AllocationError("Required amount of devices not available.")
          try:
              for dut_config in dut_config_list:
                  if not self.can_allocate(dut_config.get_requirements()):
                      raise AllocationError("Resource type is not supported")
                  self._allocate(dut_config)
          except AllocationError:
              raise
          alloc_list = AllocationContextList()
          res_id = None
          for conf in dut_config_list:
              if conf.get("type") == "mbed":
                  res_id = conf.get("allocated").get("target_id")
              context = AllocationContext(resource_id=res_id, alloc_data=conf)
              alloc_list.append(context)
          alloc_list.set_dut_init_function("serial", init_generic_serial_dut)
          alloc_list.set_dut_init_function("process", init_process_dut)
          alloc_list.set_dut_init_function("mbed", init_mbed_dut)
          return alloc_list