code: def configure(name, logfile, loglevel=logging.DEBUG):
          
  
          #        logging.config.dictConfig({
          #                'version': 1,
          #                'disable_existing_loggers': False})
  
          logger = logging.getLogger(name)
  
          # Don't propagate to root logger
          logger.propagate = False
          logger.setLevel(logging.DEBUG)
  
          datefmt = '%Y-%m-%d %H:%M:%S'
          format_stream = ('%(asctime)s %(levelname)-8s'
                           '%(name)s.%(funcName)s(): %(message)s')
          format_file = ('%(asctime)s %(levelname)-8s'
                         '%(name)s.%(funcName)s(): %(message)s')
  #        format_file = ('%(asctime)s %(levelname)-8s '
  #                       '%(name)s.%(funcName)s() '
  #                       '[%(filename)s:%(lineno)d]: %(message)s')
  
          if not logger.handlers:
  
              # Add a file handler
              if logfile is not None:
                  logfile = logfile.replace('.log', '') + '.log'
                  fh = logging.FileHandler(logfile)
                  fh.setLevel(logging.DEBUG)
                  fh.setFormatter(logging.Formatter(format_file, datefmt))
                  logger.addHandler(fh)
  
              # Add a stream handler
              ch = logging.StreamHandler()
              ch.setLevel(loglevel)
              ch.setFormatter(logging.Formatter(format_stream, datefmt))
              logger.addHandler(ch)
          else:
              logger.handlers[-1].setLevel(loglevel)
  
          return logger
docs: Create a python logger instance and configure it.
  
          Parameters
          ----------
          name : str
              Logger name.
  
          logfile : str
              Path to the log file.
  
          loglevel : int
              Default log level for STDOUT.