code: def config(stream=sys.stderr,
             level=logging.NOTSET,
             format='%(levelname)s [%(name)s:%(lineno)s] %(message)s',
             file=None,
             file_level=None,
             file_format=None):
      
      # It doesn't make sense to configure a logger with no handlers.
      assert file is not None or stream is not None
  
      # Set the formats.
      stream_format = format
      if file_format is None:
          file_format = stream_format
  
      # Get the log levels
      stream_level = log_level(level)
      if file_level is None:
          file_level = stream_level
      else:
          file_level = log_level(file_level)
  
      # Everything falls to pieces if I don't use basicConfig.
      if stream is not None:
          logging.basicConfig(stream=stream,
                              level=stream_level,
                              format=stream_format)
          # Configure file
          if file is not None:
              file = logging.FileHandler(filename=file)
              file.setLevel(file_level)
              file.setFormatter(logging.Formatter(file_format))
              logging.getLogger().addHandler(file)
      elif file is not None:
          logging.basicConfig(filename=file,
                              level=file_level,
                              format=file_format)
docs: Configure logging to stream and file concurrently.
  
      Allows setting a file and stream to log to concurrently with differing 
      level if desired.  Must provide either stream or file.
  
      Parameters
      ----------
      stream: File like:
          Stream to write file to [Default: sys.stderr]. If none, will not write 
          to stream.
  
      level: str|int
          Log level. Allowable levels are those recognized by the logging module.
  
      format: str
          Format string for the emitted logs. Default: 'log_level [logger_name] 
          message'
  
      file: str
          Path to write log to file. If None, will not log to file.
  
      file_level: str|int|None
          Overwrite log level for the file. Will default to `level` if None.
  
      file_format: str|None
          Overwrite format of logs for file. Will default to `format` if None.