def _to_primary_key(self, value):
if value is None:<EOL><INDENT>return None<EOL><DEDENT>if isinstance(value, self.base_class):<EOL><INDENT>if not value._is_loaded:<EOL><INDENT>raise exceptions.DatabaseError('<STR_LIT>')<EOL><DEDENT>return value._primary_key<EOL><DEDENT>return self.base_class._to_primary_key(value)<EOL>
Return primary key; if value is StoredObject, verify
that it is loaded.