<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def configure(*args, **kwargs):
 """ Configure logging. Borrowed from logging.basicConfig Uses the IndentFormatter instead of the regular Formatter Also, opts the caller into Syslog output, unless syslog could not be opened for some reason or another, in which case a warning will be printed to the other log handlers. """

    # Configuration must only happen once: no mechanism for avoiding
    # duplication of handlers exists.
    assert len(HANDLERS) == 0

    log_destinations = get_log_destinations()

    if 'stderr' in log_destinations:
        # Add stderr output.
        HANDLERS.append(logging.StreamHandler())

    def terrible_log_output(s):
        import sys

        print(s, file=sys.stderr)

    places = [
        # Linux
        '/dev/log',

        # FreeBSD
        '/var/run/log',

        # Macintosh
        '/var/run/syslog',
    ]

    default_syslog_address = places[0]
    for p in places:
        if path.exists(p):
            default_syslog_address = p
            break

    syslog_address = kwargs.setdefault('syslog_address',
                                       default_syslog_address)

    valid_facility = False
    if 'syslog' in log_destinations:
        facility, valid_facility = get_syslog_facility()

        if not valid_facility:
            terrible_log_output('invalid syslog facility level specified')

        try:
            # Add syslog output.
            HANDLERS.append(handlers.SysLogHandler(syslog_address,
                                                           facility=facility))
        except EnvironmentError as e:
            if e.errno in [errno.EACCES, errno.ECONNREFUSED]:
                message = ('wal-e: Could not set up syslog, '
                           'continuing anyway.  '
                           'Reason: {0}').format(errno.errorcode[e.errno])

                terrible_log_output(message)

    fs = kwargs.get("format", logging.BASIC_FORMAT)
    dfs = kwargs.get("datefmt", None)
    fmt = IndentFormatter(fs, dfs)

    for handler in HANDLERS:
        handler.setFormatter(fmt)
        logging.root.addHandler(handler)

    # Default to INFO level logging.
    set_level(kwargs.get('level', logging.INFO))