'A helper function for ``insert``, which registers the new
edge with all existing indexes.'

def _register_with_indexes(self, edge):

    for (restr_keys, index) in self._indexes.items():
        vals = tuple((self._get_type_if_possible(getattr(edge, key)()) for key in restr_keys))
        index.setdefault(vals, []).append(edge)
