code: protected TaskManagerSlot findMatchingSlot(ResourceProfile requestResourceProfile) {
  		Iterator<Map.Entry<SlotID, TaskManagerSlot>> iterator = freeSlots.entrySet().iterator();
  
  		while (iterator.hasNext()) {
  			TaskManagerSlot taskManagerSlot = iterator.next().getValue();
  
  			// sanity check
  			Preconditions.checkState(
  				taskManagerSlot.getState() == TaskManagerSlot.State.FREE,
  				"TaskManagerSlot %s is not in state FREE but %s.",
  				taskManagerSlot.getSlotId(), taskManagerSlot.getState());
  
  			if (taskManagerSlot.getResourceProfile().isMatching(requestResourceProfile)) {
  				iterator.remove();
  				return taskManagerSlot;
  			}
  		}
  
  		return null;
  	}
docs: Finds a matching slot for a given resource profile. A matching slot has at least as many
  resources available as the given resource profile. If there is no such slot available, then
  the method returns null.
  
  <p>Note: If you want to change the behaviour of the slot manager wrt slot allocation and
  request fulfillment, then you should override this method.
  
  @param requestResourceProfile specifying the resource requirements for the a slot request
  @return A matching slot which fulfills the given resource profile. Null if there is no such
  slot available.