code: def get_exporter_thread(metric_producer, exporter, interval=None):
      
      weak_get = utils.get_weakref(metric_producer.get_metrics)
      weak_export = utils.get_weakref(exporter.export_metrics)
  
      def export_all():
          get = weak_get()
          if get is None:
              raise TransportError("Metric producer is not available")
          export = weak_export()
          if export is None:
              raise TransportError("Metric exporter is not available")
          export(get())
  
      tt = MetricExporterTask(interval, export_all)
      tt.start()
      return tt
docs: Get a running task that periodically exports metrics.
  
      Get a `PeriodicTask` that periodically calls:
  
          exporter.export_metrics(metric_producer.get_metrics())
  
      :type metric_producer:
          :class:`opencensus.metrics.export.metric_producer.MetricProducer`
      :param exporter: The producer to use to get metrics to export.
  
      :type exporter: :class:`opencensus.stats.base_exporter.MetricsExporter`
      :param exporter: The exporter to use to export metrics.
  
      :type interval: int or float
      :param interval: Seconds between export calls.
  
      :rtype: :class:`PeriodicTask`
      :return: A running thread responsible calling the exporter.