docs: def create_noisy_edm(edm, noise, n=None):
      """Create noisy version of edm
      
      Adds symmetric Gaussian noise to non-diagonal elements of EDM (to distances!). 
      The output EDM is ensured to have only positive entries.
      
      :param edm: Original, noiseless EDM.
      :param noise: Standard deviation of Gaussian noise to be added to distances.
      :param n: How many rows/columns to consider. Set to size of edm by default.
      
      :return: Noisy version of input EDM.
      """
      N = edm.shape[0]
      if n is None:
          n = N
      found = False
      max_it = 100
      i = 0
      while not found:
          i += 1
          dm = np.sqrt(edm) + np.random.normal(scale=noise, size=edm.shape)
          dm = np.triu(dm)
          edm_noisy = np.power(dm + dm.T, 2)
          edm_noisy[range(N), range(N)] = 0.0
          edm_noisy[n:, n:] = edm[n:, n:]
          if (edm_noisy >= 0).all():
              found = True
          if i > max_it:
              print('create_noisy_edm: last EDM', edm_noisy)
              raise RuntimeError(
                  'Could not generate all positive edm in {} iterations.'.format(max_it))
      return edm_noisy