<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def report_spans(self):
 """ Periodically report the queued spans """

        logger.debug("Span reporting thread is now alive")

        def span_work():
            queue_size = self.queue.qsize()
            if queue_size > 0 and instana.singletons.agent.can_send():
                response = instana.singletons.agent.report_traces(self.queued_spans())
                if response:
                    logger.debug("reported %d spans" % queue_size)
            return True

        every(2, span_work, "Span Reporting")