code: def send_metrics_to_cloudwatch(self, rule, metric, dimensions):
          
  
          timestamp = datetime.datetime.utcfromtimestamp(metric.timestamp)
  
          self.log.debug(
              "CloudWatch: Attempting to publish metric: %s to %s "
              "with value (%s) for dimensions %s @%s",
              rule['name'],
              rule['namespace'],
              str(metric.value),
              str(dimensions),
              str(metric.timestamp)
          )
  
          try:
              self.connection.put_metric_data(
                  str(rule['namespace']),
                  str(rule['name']),
                  str(metric.value),
                  timestamp, str(rule['unit']),
                  dimensions)
              self.log.debug(
                  "CloudWatch: Successfully published metric: %s to"
                  " %s with value (%s) for dimensions %s",
                  rule['name'],
                  rule['namespace'],
                  str(metric.value),
                  str(dimensions))
          except AttributeError as e:
              self.log.error(
                  "CloudWatch: Failed publishing - %s ", str(e))
          except Exception as e:  # Rough connection re-try logic.
              self.log.error(
                  "CloudWatch: Failed publishing - %s\n%s ",
                  str(e),
                  str(sys.exc_info()[0]))
              self._bind()
docs: Send metrics to CloudWatch for the given dimensions