Write a function to detect outliers in a dataset using the IQR method.

Here’s a Python function to detect outliers using the Interquartile Range (IQR) method: