parameters: (spec, spec_type, names, node_name_mapping)
docstring: Function checking whether specification only references allowed set of names.
docstring_summary: Function checking whether specification only references allowed set of names.
docstring_tokens: Function checking whether specification only references allowed set of names .
function: def _check_spec(spec, spec_type, names, node_name_mapping):
      """
      Function checking whether specification only references allowed set of names.
      """
      for spec_el in spec:
          name = spec_el["name"]
          if node_name_mapping:
              keras_name = node_name_mapping.get(name)
              if keras_name is None:
                  raise ValueError(
                      "{spec_type} {name} is not mapped in node_name_mapping."
                      "".format(spec_type=spec_type, name=name).capitalize()
                  )
              if keras_name not in names:
                  raise ValueError(
                      "{spec_type} {name} mapped to {keras_name} is not in model {spec_type}s."
                      "".format(
                          spec_type=spec_type, name=name, keras_name=keras_name
                      ).capitalize()
                  )
          else:
              if name not in names:
                  raise ValueError(
                      "{spec_type} {name} is not in model {spec_type}s."
                      "".format(spec_type=spec_type, name=name).capitalize()
                  )
function_tokens: def _check_spec ( spec , spec_type , names , node_name_mapping ) : for spec_el in spec : name = spec_el [ "name" ] if node_name_mapping : keras_name = node_name_mapping . get ( name ) if keras_name is None : raise ValueError ( "{spec_type} {name} is not mapped in node_name_mapping." "" . format ( spec_type = spec_type , name = name ) . capitalize ( ) ) if keras_name not in names : raise ValueError ( "{spec_type} {name} mapped to {keras_name} is not in model {spec_type}s." "" . format ( spec_type = spec_type , name = name , keras_name = keras_name ) . capitalize ( ) ) else : if name not in names : raise ValueError ( "{spec_type} {name} is not in model {spec_type}s." "" . format ( spec_type = spec_type , name = name ) . capitalize ( ) )