def indexBy(self, val=None):
        """
        Indexes the object's values by a criterion, similar to
        `groupBy`, but for when you know that your index values will be unique.
        """
        if val is None:
            val = lambda *args: args[0]

        def by(result, key, value):
            result[key] = value

        res = self._group(self.obj, val, by)

        return self._wrap(res)
def indexBy ( self , val = None ) : if val is None : val = lambda * args : args [ 0 ] def by ( result , key , value ) : result [ key ] = value res = self . _group ( self . obj , val , by ) return self . _wrap ( res )
Indexes the object's values by a criterion, similar to
        `groupBy`, but for when you know that your index values will be unique.