Run a job, either passed in or from the queue.

        A job is a tuple of function and optional args. Keyword arguments
        can be passed via use of functools.partial. The job should return a
        string that should be sent by the gateway protocol. The function will
        be called with the arguments and the result will be returned.

def run_job(self, job=None):
        """Run a job, either passed in or from the queue.

        A job is a tuple of function and optional args. Keyword arguments
        can be passed via use of functools.partial. The job should return a
        string that should be sent by the gateway protocol. The function will
        be called with the arguments and the result will be returned.
        """
        if job is None:
            if not self.queue:
                return None
            job = self.queue.popleft()
        start = timer()
        func, args = job
        reply = func(*args)
        end = timer()
        if end - start > 0.1:
            _LOGGER.debug(
                'Handle queue with call %s(%s) took %.3f seconds',
                func, args, end - start)
        return reply