code: def load_statsd(self):
          
          if not self.statsd_enabled:
              logger.info('Stats reporting is not enabled, connection is not allowed')
              return False
  
          if self.statsd_enabled and self.carbon:
              self.my_metrics.append(('.'.join([self.statsd_prefix, self.name, 'connection-test']),
                                      (int(time.time()), int(time.time()))))
              self.carbon.add_data_list(self.my_metrics)
              self.flush(log=True)
          else:
              try:
                  logger.info('Trying to contact StatsD server...')
                  self.statsd_addr = (socket.gethostbyname(self.statsd_host.encode('utf-8')),
                                      self.statsd_port)
                  self.statsd_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
              except (socket.error, socket.gaierror) as exp:
                  logger.warning('Cannot create StatsD socket: %s', exp)
                  return False
              except Exception as exp:  # pylint: disable=broad-except
                  logger.exception('Cannot create StatsD socket (other): %s', exp)
                  return False
  
              logger.info('StatsD server contacted')
          return True
docs: Create socket connection to statsd host
  
          Note that because of the UDP protocol used by StatsD, if no server is listening the
          socket connection will be accepted anyway :)
  
          :return: True if socket got created else False and an exception log is raised