def produce_context(namespace, context_id, max_delay=None):
try:<EOL><INDENT>context_obj = get_context(namespace, context_id)<EOL>logger.info("<STR_LIT>", namespace, context_id)<EOL><DEDENT>except ContextError:<EOL><INDENT>logger.info("<STR_LIT>", namespace, context_id)<EOL>if max_delay is not None:<EOL><INDENT>max_delay = float(max_delay)<EOL><DEDENT>logger.info("<STR_LIT>", max_delay)<EOL>if not max_delayor arrival_delay_greater_than(context_id, max_delay):<EOL><INDENT>context_obj = {}<EOL>logger.info(<EOL>"<STR_LIT>",<EOL>max_delay, context_id)<EOL><DEDENT>else:<EOL><INDENT>msg = "<STR_LIT>".format(context_id)<EOL>raise OutOfOrderError(msg)<EOL><DEDENT><DEDENT>return context_obj<EOL>
Produce event context.