code: def validate_constraints(
      non_negative=None,
      l1_reg=None,
      l2_reg=None,
      l2_square_reg=None,
      unimodality=None,
      normalize=None,
      simplex=None,
      normalized_sparsity=None,
      soft_sparsity=None,
      smoothness=None,
      monotonicity=None,
      hard_sparsity=None,
      n_const=1,
      order=0,
  ):
      """
      Validates input constraints for constrained parafac decomposition and returns a constraint and a parameter for
      proximal operator.
  
      Parameters
      ----------
      non_negative : bool or dictionary
          This constraint is clipping negative values to '0'.
          If it is True, non-negative constraint is applied to all modes.
      l1_reg : float or list or dictionary, optional
          Penalizes the factor with the l1 norm using the input value as regularization parameter.
      l2_reg : float or list or dictionary, optional
          Penalizes the factor with the l2 norm using the input value as regularization parameter.
      l2_square_reg : float or list or dictionary, optional
          Penalizes the factor with the l2 square norm using the input value as regularization parameter.
      unimodality : bool or dictionary, optional
          If it is True, unimodality constraint is applied to all modes.
          Applied to each column seperately.
      normalize : bool or dictionary, optional
          This constraint divides all the values by maximum value of the input array.
          If it is True, normalize constraint is applied to all modes.
      simplex : float or list or dictionary, optional
          Projects on the simplex with the given parameter
          Applied to each column seperately.
      normalized_sparsity : float or list or dictionary, optional
          Normalizes with the norm after hard thresholding
      soft_sparsity : float or list or dictionary, optional
          Impose that the columns of factors have L1 norm bounded by a user-defined threshold.
      smoothness : float or list or dictionary, optional
          Optimizes the factors by solving a banded system
      monotonicity : bool or dictionary, optional
          Projects columns to monotonically decreasing distrbution
          Applied to each column seperately.
          If it is True, monotonicity constraint is applied to all modes.
      hard_sparsity : float or list or dictionary, optional
          Hard thresholding with the given threshold
      n_const : int
          Number of constraints. If it is None, function returns input tensor.
          Default : 1
      order : int
          Specifies which constraint to implement if several constraints are selected as input
          Default : 0
      Returns
      -------
      constraint : string
      parameter : float
      """
      constraints = [None] * n_const
      parameters = [None] * n_const
      if non_negative:
          if isinstance(non_negative, dict):
              modes = list(non_negative)
              for i in range(len(modes)):
                  constraints[modes[i]] = "non_negative"
          else:
              for i in range(len(constraints)):
                  constraints[i] = "non_negative"
      if l1_reg:
          if isinstance(l1_reg, dict):
              modes = list(l1_reg)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "l1_reg"
                  parameters[modes[i]] = l1_reg[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "l1_reg"
                  if isinstance(l1_reg, list):
                      parameters[i] = l1_reg[i]
                  else:
                      parameters[i] = l1_reg
      if l2_reg:
          if isinstance(l2_reg, dict):
              modes = list(l2_reg)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "l2_reg"
                  parameters[modes[i]] = l2_reg[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "l2_reg"
                  if isinstance(l2_reg, list):
                      parameters[i] = l2_reg[i]
                  else:
                      parameters[i] = l2_reg
      if l2_square_reg:
          if isinstance(l2_square_reg, dict):
              modes = list(l2_square_reg)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "l2_square_reg"
                  parameters[modes[i]] = l2_square_reg[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "l2_square_reg"
                  if isinstance(l2_square_reg, list):
                      parameters[i] = l2_square_reg[i]
                  else:
                      parameters[i] = l2_square_reg
      if normalized_sparsity:
          if isinstance(normalized_sparsity, dict):
              modes = list(normalized_sparsity)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "normalized_sparsity"
                  parameters[modes[i]] = normalized_sparsity[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "normalized_sparsity"
                  if isinstance(normalized_sparsity, list):
                      parameters[i] = normalized_sparsity[i]
                  else:
                      parameters[i] = normalized_sparsity
      if soft_sparsity:
          if isinstance(soft_sparsity, dict):
              modes = list(soft_sparsity)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "soft_sparsity"
                  parameters[modes[i]] = soft_sparsity[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "soft_sparsity"
                  if isinstance(soft_sparsity, list):
                      parameters[i] = soft_sparsity[i]
                  else:
                      parameters[i] = soft_sparsity
      if hard_sparsity:
          if isinstance(hard_sparsity, dict):
              modes = list(hard_sparsity)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "hard_sparsity"
                  parameters[modes[i]] = hard_sparsity[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "hard_sparsity"
                  if isinstance(hard_sparsity, list):
                      parameters[i] = hard_sparsity[i]
                  else:
                      parameters[i] = hard_sparsity
      if simplex:
          if isinstance(simplex, dict):
              modes = list(simplex)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "simplex"
                  parameters[modes[i]] = simplex[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "simplex"
                  if isinstance(simplex, list):
                      parameters[i] = simplex[i]
                  else:
                      parameters[i] = simplex
      if smoothness:
          if isinstance(smoothness, dict):
              modes = list(smoothness)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "smoothness"
                  parameters[modes[i]] = smoothness[modes[i]]
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "smoothness"
                  if isinstance(smoothness, list):
                      parameters[i] = smoothness[i]
                  else:
                      parameters[i] = smoothness
      if unimodality:
          if isinstance(unimodality, dict):
              modes = list(unimodality)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "unimodality"
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "unimodality"
      if monotonicity:
          if isinstance(monotonicity, dict):
              modes = list(monotonicity)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "monotonicity"
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "monotonicity"
      if normalize:
          if isinstance(normalize, dict):
              modes = list(normalize)
              for i in range(len(modes)):
                  if constraints[modes[i]] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[modes[i]] = "normalize"
          else:
              for i in range(len(constraints)):
                  if constraints[i] is not None:
                      raise ValueError(
                          "You selected two constraints for the same mode. Consider to check your input"
                      )
                  constraints[i] = "normalize"
      return constraints[order], parameters[order]
  
file_path: tensorly/tensorly/tenalg/proximal.py
imports: import tensorly
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: validate_constraints(non_negative, l1_reg, l2_reg, l2_square_reg, unimodality, normalize, simplex, normalized_sparsity, soft_sparsity, smoothness, monotonicity, hard_sparsity, n_const, order) and returns: constraints,  parameters