def __contains__(self, key):
        """Dictionary-style membership test by either ID or name"""
        if isinstance(key, _numbers.Integral):
            return key in self._by_id
        else:
            return key in self._by_name
def __contains__ ( self , key ) : if isinstance ( key , _numbers . Integral ) : return key in self . _by_id else : return key in self . _by_name
Dictionary-style membership test by either ID or name