<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def init_logging(stream=sys.stderr, filepath=None, format='%(asctime).19s [%(levelname)s] %(name)s: %(message)s'):
 """ Setup logging for the microcache module, but only do it once! :param stream: stream to log to (defaults to sys.stderr) :param filepath: path to a file to log to as well (defaults to None) :param format: override the default format with whatever you like """

    if not (len(logger.handlers) == 1 and isinstance(logger.handlers[0], logging.NullHandler)):
        logger.warn('logging has already been initialized, refusing to do it again')
        return
    formatter = logging.Formatter(format)
    if stream is not None:
        handler = logging.StreamHandler(stream=stream)
        handler.setFormatter(formatter)
        logger.addHandler(handler)
    if filepath is not None:
        handler = logging.FileHandler(filename=filepath)
        handler.setFormatter(formatter)
        logger.addHandler(handler)
    logger.info('successfully initialized logger')