code: def allocate(self, dut_configuration_list, args=None):
          
          dut_config_list = dut_configuration_list.get_dut_configuration()
          # if we need one or more local hardware duts let's search attached
          # devices using DutDetection
          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.")
  
          # Enumerate all required DUT's
          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:
              # Locally allocated don't need to be released any way for
              # now, so just re-raise the error
              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
docs: Allocates resources from available local devices.
  
          :param dut_configuration_list: List of ResourceRequirements objects
          :param args: Not used
          :return: AllocationContextList with allocated resources