code: def euclidean_distances(X, Y, squared=False):
      
      XX = np.einsum('ij,ij->i', X, X)[:, np.newaxis]
      YY = np.einsum('ij,ij->i', Y, Y)[np.newaxis, :]
      distances = np.dot(X, Y.T)
      distances *= -2
      distances += XX
      distances += YY
      np.maximum(distances, 0, out=distances)
      if X is Y:
          # Ensure that distances between vectors and themselves are set to 0.0.
          # This may not be the case due to floating point rounding errors.
          distances.flat[::distances.shape[0] + 1] = 0.0
      return distances if squared else np.sqrt(distances, out=distances)
docs: Considering the rows of X (and Y=X) as vectors, compute the
      distance matrix between each pair of vectors.
      Parameters
      ----------
      X : {array-like}, shape (n_samples_1, n_features)
      Y : {array-like}, shape (n_samples_2, n_features)
      squared : boolean, optional
          Return squared Euclidean distances.
      Returns
      -------
      distances : {array}, shape (n_samples_1, n_samples_2)