code: def get_normalised_generator(frequencies, rate_matrix=None):
      
      if rate_matrix is None:
          n = len(frequencies)
          rate_matrix = np.ones(shape=(n, n), dtype=np.float64) - np.eye(n)
      generator = rate_matrix * frequencies
      generator -= np.diag(generator.sum(axis=1))
      mu = -generator.diagonal().dot(frequencies)
      generator /= mu
      return generator
docs: Calculates the normalised generator from the rate matrix and character state frequencies.
  
      :param frequencies: character state frequencies.
      :type frequencies: numpy.array
      :param rate_matrix: (optional) rate matrix (by default an all-equal-rate matrix is used)
      :type rate_matrix: numpy.ndarray
      :return: normalised generator 1/mu Q
      :rtype: numpy.ndarray