def name_to_id(self, name, add_if_missing=False):
        """ Lookup name in the names list, or optionally add. """
        if type(name) in str:
            # lookup name or assign new
            if name not in self.names:
                if not add_if_missing:
                    raise ValueError("name " + name + " not found")
                # Use an empty slot in the list if one exists.
                try:
                    id_ = self.names.index(None)
                    self.names[id_] = name
                    self.hashesperid[id_] = 0
                except ValueError:
                    self.names.append(name)
                    self.hashesperid = np.append(self.hashesperid, [0])
            id_ = self.names.index(name)
        else:
            # we were passed in a numerical id
            id_ = name
        return id_
dataset/ETHPy150Open dpwe/audfprint/hash_table.py/HashTable.name_to_id/operator `is` -> `in`