code: def initialize_collector(cls, name=None, configfile=None, handlers=[]):
      
      collector = None
  
      try:
          # Initialize Collector
          collector = cls(name=name, configfile=configfile, handlers=handlers)
      except Exception:
          # Log error
          logger.error("Failed to initialize Collector: %s. %s",
                       cls.__name__, traceback.format_exc())
  
      # Return collector
      return collector
docs: Initialize collector