'Return an identity-map key for use in storing/retrieving an
item from the identity map.
:param row: A :class:`.RowProxy` instance.  The columns which are mapped
by this :class:`.Mapper` should be locatable in the row, preferably
via the :class:`.Column` object directly (as is the case when a
:func:`.select` construct is executed), or via string names of the form
``<tablename>_<colname>``.'

def identity_key_from_row(self, row, adapter=None):

    pk_cols = self.primary_key
    if adapter:
        pk_cols = [adapter.columns[c] for c in pk_cols]
    return (self._identity_class, tuple((row[column] for column in pk_cols)))
