<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _api_wrapper(fn):
 """API function decorator that performs rate limiting and error checking."""


    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