code: def _api_wrapper(fn):
      
  
      def _convert(value):
          if isinstance(value, _datetime.date):
              return value.strftime('%s')
          return value
  
      @_six.wraps(fn)
      def _fn(self, command, **params):
          # sanitize the params by removing the None values
          with self.startup_lock:
              if self.timer.ident is None:
                  self.timer.setDaemon(True)
                  self.timer.start()
          params = dict((key, _convert(value))
                        for key, value in _six.iteritems(params)
                        if value is not None)
  
          self.semaphore.acquire()
          resp = fn(self, command, **params)
          try:
              respdata = resp.json(object_hook=_AutoCastDict)
          except:
              # use more specific error if available or fallback to ValueError
              resp.raise_for_status()
              raise Exception('No JSON object could be decoded')
  
          # check for 'error' then check for status due to Poloniex inconsistency
          if 'error' in respdata:
              raise PoloniexCommandException(respdata['error'])
  
          resp.raise_for_status()
          return respdata
  
      return _fn
docs: API function decorator that performs rate limiting and error checking.