code: def encode_domains(X, y, domain):
      r"""Encode the domains of the matrices in the labels.
  
      We handle the possibility of having different domains for the datasets by
      extending the labels of the matrices and including this information to
      them. For instance, if we have a matrix X with class `left_hand` on the
      `domain_01` then its extended label will be `domain_01/left_hand`. Note
      that if the classes were integers at first, they will be converted to
      strings.
  
      Parameters
      ----------
      X : ndarray, shape (n_matrices, n_channels, n_channels)
          Set of SPD matrices.
      y : ndarray, shape (n_matrices,)
          Labels for each matrix.
      domain : ndarray, shape (n_matrices,)
          Domains for each matrix.
  
      Returns
      -------
      X_enc : ndarray, shape (n_matrices, n_channels, n_channels)
          The same set of SPD matrices given as input.
      y_enc : ndarray, shape (n_matrices,)
          Extended labels for each matrix.
  
      See Also
      --------
      decode_domains
  
      Notes
      -----
      .. versionadded:: 0.4
      """
      if len(y) != len(domain):
          raise ValueError("Input lengths don't match")
  
      y_enc = [str(d_) + "/" + str(y_) for (d_, y_) in zip(domain, y)]
      return X, np.array(y_enc)
  
imports: import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: encode_domains(X, y, domain) and returns: X,  np