code: def max_temperature(self,  unit='kelvin'):
          
          if unit not in ('kelvin', 'celsius', 'fahrenheit'):
              raise ValueError("Invalid value for parameter 'unit'")
          maximum = max(self._purge_none_samples(self.temperature_series()),
                     key=itemgetter(1))
          if unit == 'kelvin':
              result = maximum
          if unit == 'celsius':
              result = (maximum[0], temputils.kelvin_to_celsius(maximum[1]))
          if unit == 'fahrenheit':
              result = (maximum[0], temputils.kelvin_to_fahrenheit(maximum[1]))
          return result
docs: Returns a tuple containing the max value in the temperature
          series preceeded by its timestamp
          
          :param unit: the unit of measure for the temperature values. May be
              among: '*kelvin*' (default), '*celsius*' or '*fahrenheit*'
          :type unit: str
          :returns: a tuple
          :raises: ValueError when invalid values are provided for the unit of
              measure or the measurement series is empty