def _get_m2m_attr(self, related, attr):
        cache_attr = '_m2m_%s_cache' % attr
        if hasattr(self, cache_attr):
            return getattr(self, cache_attr)
        for f in self.rel.through._meta.fields:
            if hasattr(f, 'rel') and f.rel and f.rel.to == related.model:
                setattr(self, cache_attr, getattr(f, attr))
                return getattr(self, cache_attr)
Creates a key for the given value map.
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/models/fields/related.py/ManyToManyField._get_m2m_attr--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/datastore/datastore_query.py/Order._key