Arguments parsing, etc..

def main(args, stop=False):
    """
    Arguments parsing, etc..
    """
    daemon = AMQPDaemon(
        con_param=getConParams(
            settings.RABBITMQ_PDFGEN_VIRTUALHOST
        ),
        queue=settings.RABBITMQ_PDFGEN_INPUT_QUEUE,
        out_exch=settings.RABBITMQ_PDFGEN_EXCHANGE,
        out_key=settings.RABBITMQ_PDFGEN_OUTPUT_KEY,
        react_fn=reactToAMQPMessage,
        glob=globals()                # used in deserializer
    )

    if not stop and args.foreground:  # run at foreground
        daemon.run()
    else:
        daemon.run_daemon()