input: Write a python function to find the optimal number of clusters using the Elbow Method and visualize the results using distortions and inertias.
  assert optimal_k(np.random.rand(100, 2)) is None
  assert optimal_k(np.random.rand(200, 3)) is None
output: def optimal_k(data):
      from sklearn.cluster import KMeans
      import matplotlib.pyplot as plt
      import numpy as np
  
      distortions = []
      inertias = []
      K = range(1, 11)
  
      for k in K:
          kmeans = KMeans(n_clusters=k, random_state=42)
          kmeans.fit(data)
          distortions.append(sum(np.min(cdist(data, kmeans.cluster_centers_, 'euclidean'), axis=1)) / data.shape[0])
          inertias.append(kmeans.inertia_)
  
      plt.figure(figsize=(15, 5))
  
      plt.subplot(1, 2, 1)
      plt.plot(K, distortions, 'bx-')
      plt.xlabel('k')
      plt.ylabel('Distortion')
      plt.title('The Elbow Method using Distortion')
  
      plt.subplot(1, 2, 2)
      plt.plot(K, inertias, 'bx-')
      plt.xlabel('k')
      plt.ylabel('Inertia')
      plt.title('The Elbow Method using Inertia')
  
      plt.show()