def launch_server(message_handler, options):
    """
    Launch a message server
    :param handler_function: The handler function to execute for each message
    :param options: Application options for TCP, etc.
    """
    logger = logging.getLogger(__name__)
 #   if (options.debug):
 #       logger.setLevel(logging.DEBUG)

#    if not options.monitor_port:
#        logger.warning(
#            "Monitoring not enabled. No monitor-port option defined.")
#    else:
#        threading.Thread(target=launch_monitor_server, args=(options.host, options.monitor_port, logger)).start()

    # Create the server, binding to specified host on configured port

#   logger.info(
#        'Starting server on host %s port %d Python version %s.%s.%s' % ((options.host, options.port) + sys.version_info[:3]))
#    server = ThreadedTCPServer((options.host, options.port),

    # Activate the server; this will keep running until you
    # interrupt the program with Ctrl-C
    try:
        while True:
            logger.debug('waiting for more data')
            if not message_handler.handle():
                break
        logger.warning("I/O stream closed from client")

    except KeyboardInterrupt:
        logger.info("I/O stream closed from client exiting...")
        os._exit(142)

    except:
        logger.exception("Error encountered handling message")