code: def to_bucket(self, timestamp, steps=0):
      '''
      Calculate the bucket from a timestamp.
      '''
      dt = datetime.utcfromtimestamp( timestamp )
  
      if steps!=0:
        if self._step == 'daily':
          dt = dt + timedelta(days=steps)
        elif self._step == 'weekly':
          dt = dt + timedelta(weeks=steps)
        elif self._step == 'monthly':
          dt = dt + MonthDelta(steps)
        elif self._step == 'yearly':
          year = int(dt.strftime( self.FORMATS[self._step] ))
          year += steps
          dt = datetime(year=year, month=1, day=1)
  
      return int(dt.strftime( self.FORMATS[self._step] )f to_bucket(self, timestamp, steps=0):
      '''
      Calculate the bucket from a timestamp.
      '''
      dt = datetime.utcfromtimestamp( timestamp )
  
      if steps!=0:
        if self._step == 'daily':
          dt = dt + timedelta(days=steps)
        elif self._step == 'weekly':
          dt = dt + timedelta(weeks=steps)
        elif self._step == 'monthly':
          dt = dt + MonthDelta(steps)
        elif self._step == 'yearly':
          year = int(dt.strftime( self.FORMATS[self._step] ))
          year += steps
          dt = datetime(year=year, month=1, day=1)
  
      return int(dt.strftime( self.FORMATS[self._step] ))
docs: Calculate the bucket from a timestamp.