code: def ensure_nest_alts_are_valid_alts(nest_spec, list_elements, all_ids):
      
      invalid_alt_ids = []
      for x in list_elements:
          if x not in all_ids:
              invalid_alt_ids.append(x)
      if invalid_alt_ids != []:
          msg = "The following elements are not in df[alt_id_col]: {}"
          raise ValueError(msg.format(invalid_alt_ids))
  
      return None
docs: Ensures that the alternative id's in `nest_spec` are all in the universal
      choice set for this dataset. Raises a helpful ValueError if they are not.
  
      Parameters
      ----------
      nest_spec : OrderedDict, or None, optional.
          Keys are strings that define the name of the nests. Values are lists of
          alternative ids, denoting which alternatives belong to which nests.
          Each alternative id must only be associated with a single nest!
          Default == None.
      list_elements : list of ints.
          Each element should correspond to one of the alternatives identified as
          belonging to a nest.
      all_ids : list of ints.
          Each element should correspond to one of the alternatives that is
          present in the universal choice set for this model.
  
      Returns
      -------
      None.