code: def _ensure_flat(layers):
      """Ensures that layers is a single flat list of Layer instances."""
      if len(layers) == 1 and layers[0] is None:
          layers = ()
      else:
          layers = _deep_flatten(layers)
      for obj in layers:
          if not isinstance(obj, tl.Layer):
              raise ValueError(
                  f"Found nonlayer object ({obj}) in layers: {layers}"
              )
      return layers
  
file_path: trax/trax/models/research/rezero.py
imports: from trax import layers
  from trax.fastmath import numpy
label_desc: Use image node_id 11 for calling a global function with example usage: _ensure_flat(layers) and returns: layers