code: def _get_initial_ktensor(init, X, rank, random_state, scale_norm=True):
      
      normX = linalg.norm(X) if scale_norm else None
  
      if init == 'randn':
          # TODO - match the norm of the initialization to the norm of X.
          U = randn_ktensor(X.shape, rank, norm=normX, random_state=random_state)
  
      elif init == 'rand':
          # TODO - match the norm of the initialization to the norm of X.
          U = rand_ktensor(X.shape, rank, norm=normX, random_state=random_state)
  
      elif isinstance(init, KTensor):
          U = init.copy()
  
      else:
          raise ValueError("Expected 'init' to either be a KTensor or a string "
                           "specifying how to initialize optimization. Valid "
                           "strings are ('randn', 'rand').")
  
      return U, normX
docs: Parameters
      ----------
      init : str
          Specifies type of initializations ('randn', 'rand')
      X : ndarray
          Tensor that the decomposition is fit to.
      rank : int
          Rank of decomposition
      random_state : RandomState or int
          Specifies seed for random number generator
      scale_norm : bool
          If True, norm is scaled to match X (default: True)
  
      Returns
      -------
      U : KTensor
          Initial factor matrices used optimization.
      normX : float
          Frobenious norm of tensor data.