<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setup_local_logging(config=None, parallel=None):
 """Setup logging for a local context, directing messages to appropriate base loggers. Handles local, multiprocessing and distributed setup, connecting to handlers created by the base logger. """

    if config is None: config = {}
    if parallel is None: parallel = {}
    parallel_type = parallel.get("type", "local")
    cores = parallel.get("cores", 1)
    wrapper = parallel.get("wrapper", None)
    if parallel_type == "ipython":
        from bcbio.log import logbook_zmqpush
        handler = logbook_zmqpush.ZeroMQPushHandler(parallel["log_queue"])
    elif cores > 1:
        handler = logbook.queues.MultiProcessingHandler(mpq)
    else:
        handler = _create_log_handler(config, direct_hostname=wrapper is not None, write_toterm=wrapper is None)
    handler.push_thread()
    return handler