def avg(self, key=None):
        """
        Get the average value of a given key.

        :param key: The key to get the average for
        :type key: mixed

        :rtype: float or int
        """
        count = self.count()

        if count:
            return self.sum(key) / count
def avg ( self , key = None ) : count = self . count ( ) if count : return self . sum ( key ) / count
Get the average value of a given key.

        :param key: The key to get the average for
        :type key: mixed

        :rtype: float or int