def METHOD_NAME(name='default_logger', level=logging.INFO, use_format=False,
               out_stream='stdout', out_file=None, lock=None):
    """
    Return a logger that writes to an I/O stream.
    Parameters
    ----------
    name : str
        Name of the logger to be returned, will be created if it doesn't exist.
    level : int
        Logging level for this logger. Default is logging.INFO (level 20).
        (applied only when creating a new logger or setting a new stream).
    use_format : bool
        Set to True to use the openmdao format "Level: message".
        (applied only when creating a new logger or setting a new stream).
    out_stream : 'stdout', 'stderr' or file-like
        Output stream to which logger output will be directed.
    out_file : str or None
        If not None, add a FileHandler to write to this file.
    lock : bool
        If True, do not allow the handler to be changed until unlocked.
        If False, unlock the handler for the logger.
    Returns
    -------
    <logging.Logger>
        Logger that writes to a stream and adheres to requested settings.
    """
    if out_stream == 'stdout':
        out_stream = sys.stdout
    elif out_stream == 'stderr':
        out_stream = sys.stderr
    if name in _loggers:
        # use existing logger
        info = _loggers[name]
        logger = info['logger']
        stream = info['stream']
        ofile = info['file']
        locked = info['locked']
        unlock = lock is False
        # redirect log to new stream (if not locked)
        if (out_stream != stream or ofile != out_file) and (not locked or unlock):
            for handler in logger.handlers:
                logger.removeHandler(handler)
            if out_stream:
                _set_handler(logger, logging.StreamHandler(out_stream), level, use_format)
            if out_file:
                _set_handler(logger, logging.FileHandler(out_file, mode='w'), level, use_format)
            info['stream'] = out_stream
            info['file'] = out_file
        # update locked status
        info['locked'] = lock
    else:
        # create new logger
        logger = logging.getLogger(name)
        logger.setLevel(level)
        if out_stream:
            _set_handler(logger, logging.StreamHandler(out_stream), level, use_format)
        if out_file:
            _set_handler(logger, logging.FileHandler(out_file, mode='w'), level, use_format)
        _loggers[name] = {
            'logger': logger,
            'stream': out_stream,
            'file': out_file,
            'locked': lock
        }
    return logger