class_docstr: Hidden API for overriding/modifying the behavior of a Parameter,
  which is itself a Layered object.
  
  Layers can be added and will be ordered depending on their level
class_docstr_tok: ["Hidden","API","for","overriding\/modifying","the","behavior","of","a","Parameter",",","which","is","itself","a","Layered","object",".","Layers","can","be","added","and","will","be","ordered","depending","on","their","level"]
docstr: Adds a layer which will modify the object behavior
docstr_tok: ["Adds","a","layer","which","will","modify","the","object","behavior"]
code: def add_layer(self: L, other: "Layered") -> L:
      """Adds a layer which will modify the object behavior"""
      if self is not self._layers[0] or self._LAYER_LEVEL != Level.ROOT:
          raise errors.NevergradRuntimeError(
              "Layers can only be added from the root."
          )
      if len(other._layers) > 1:
          raise errors.NevergradRuntimeError(
              "Cannot append multiple layers at once"
          )
      if (
          other._LAYER_LEVEL.value
          >= self._layers[-1]._LAYER_LEVEL.value
      ):
          other._layer_index = len(self._layers)
          self._layers.append(other)
      else:
          levels = [x._LAYER_LEVEL.value for x in self._layers]
          ind = bisect.bisect_right(levels, other._LAYER_LEVEL.value)
          self._layers.insert(ind, other)
          for k, x in enumerate(self._layers):
              x._layer_index = k
      other._layers = self._layers
      other._on_layer_added()
      return self
  
imports: import uuid
  import copy
  import bisect
  from enum import Enum
  import numpy
  from nevergrad.common import errors
  import nevergrad.common.typing
label_desc: Use image node_id 2 for calling the Layered obj's underlying member method code with example usage: obj.add_layer(other) and returns: self