code: def _enforce_names_consistency(specs):
      """Enforces that either all specs have names or none do."""
  
      def _has_name(spec):
          return hasattr(spec, "name") and spec.name is not None
  
      def _clear_name(spec):
          spec = copy.deepcopy(spec)
          if hasattr(spec, "name"):
              spec._name = None  # pylint:disable=protected-access
          return spec
  
      flat_specs = nest.flatten(specs)
      name_inconsistency = any(
          _has_name(s) for s in flat_specs
      ) and not all(_has_name(s) for s in flat_specs)
  
      if name_inconsistency:
          specs = nest.map_structure(_clear_name, specs)
      return specs
  
file_path: tensorflow-upstream/tensorflow/lite/python/tflite_keras_util.py
imports: import copy
  from tensorflow.python.eager import def_function
  from tensorflow.python.util import keras_deps
  from tensorflow.python.util import nest
  from tensorflow.python.util.compat import collections_abc
label_desc: Use image node_id 1 for calling a global function with example usage: _enforce_names_consistency(specs) and returns: specs, unknown, spec