class_docstr: A repository mapping names -> publishers
  
  As a usability optimization, using this Repository will eagerly load and register all
  publishers in the application.
class_docstr_tok: ["A","repository","mapping","names","-",">","publishers","As","a","usability","optimization",",","using","this","Repository","will","eagerly","load","and","register","all","publishers","in","the","application","."]
docstr: Registers the publisher into the repository.
  
  To standardize the interface of publishers, if a function publisher is given, it will be
  wrapped with a WrappedFunctionPublisher instance prior to being registed into the
  Repository.
  
  Args:
       publisher (callable|AlertPublisher): An instance of a publisher class or a function
docstr_tok: ["Registers","the","publisher","into","the","repository",".","To","standardize","the","interface","of","publishers",",","if","a","function","publisher","is","given",",","it","will","be","wrapped","with","a","WrappedFunctionPublisher","instance","prior","to","being","registed","into","the","Repository",".","Args",":","publisher","(","callable|AlertPublisher",")",":","An","instance","of","a","publisher","class","or","a","function"]
code: def register_publisher(cls, publisher):
      """Registers the publisher into the repository.
  
      To standardize the interface of publishers, if a function publisher is given, it will be
      wrapped with a WrappedFunctionPublisher instance prior to being registed into the
      Repository.
  
      Args:
           publisher (callable|AlertPublisher): An instance of a publisher class or a function
      """
      if not AlertPublisherRepository.is_valid_publisher(publisher):
          error = (
              "Could not register publisher {}; Not callable nor subclass of AlertPublisher"
          ).format(publisher)
          raise PublisherRegistrationError(error)
  
      if isclass(publisher):
          # If the provided publisher is a Class, then we simply need to instantiate an instance
          # of the class and register it.
          publisher_instance = publisher()
      else:
          # If the provided publisher is a function, we wrap it with a WrappedFunctionPublisher
          # to make them easier to handle.
          publisher_instance = WrappedFunctionPublisher(publisher)
  
      name = AlertPublisherRepository.get_publisher_name(publisher)
  
      if name in cls._publishers:
          error = "Publisher with name [{}] has already been registered.".format(
              name
          )
          raise PublisherRegistrationError(error)
  
      cls._publishers[name] = publisher_instance
  
imports: from abc import abstractmethod
  from copy import deepcopy
  from inspect import isclass
  from streamalert.shared.config import load_config
  from streamalert.shared.importer import import_folders
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 4 for calling the AlertPublisherRepository obj's underlying member method code with example usage: obj.register_publisher(cls, publisher) without return types