def METHOD_NAME():
    d = {"12345": "12345"}
    length = 5
    with mock.patch("mlflow.utils._logger.warning") as mock_warning:
        max_length = length - 1
        # Truncate keys
        assert _truncate_dict(d, max_key_length=max_length) == {"1...": "12345"}
        mock_warning.assert_called_once_with("Truncated the key `1...`")
        mock_warning.reset_mock()
        # Truncate values
        assert _truncate_dict(d, max_value_length=max_length) == {"12345": "1..."}
        mock_warning.assert_called_once_with(
            "Truncated the value of the key `12345`. Truncated value: `1...`"
        )
        mock_warning.reset_mock()
        # Truncate both keys and values
        assert _truncate_dict(d, max_key_length=max_length, max_value_length=max_length) == {
            "1...": "1..."
        }
        assert mock_warning.call_count == 2
        (args1, _), (args2, _) = mock_warning.call_args_list
        assert args1[0] == "Truncated the key `1...`"
        assert args2[0] == "Truncated the value of the key `1...`. Truncated value: `1...`"
    assert _truncate_dict(d, max_key_length=length, max_value_length=length) == {"12345": "12345"}
    assert _truncate_dict(d, max_key_length=length + 1, max_value_length=length + 1) == {
        "12345": "12345"
    }
    with pytest.raises(
        ValueError, match="Must specify at least either `max_key_length` or `max_value_length`"
    ):
        _truncate_dict(d)