def compute_index_key(self, to_instance):
kwargs = dict()<EOL>for attr in self.key_map.values():<EOL><INDENT>if _is_null(to_instance, attr):<EOL><INDENT>return None<EOL><DEDENT>if attr in to_instance.__dict__:<EOL><INDENT>kwargs[attr] = to_instance.__dict__[attr]<EOL><DEDENT>else:<EOL><INDENT>kwargs[attr] = getattr(to_instance, attr)<EOL><DEDENT><DEDENT>return frozenset(tuple(kwargs.items()))<EOL>
Compute the index key that can be used to identify an instance
on the link.