def format_reply(details, opts):
    """Returns a reply that contains the output from a ideone submission's
    details along with optional additional information.
    """
    head, body, extra, = '', '', ''
    # Combine information that will go before the output.
    if '--source' in opts:
        head += 'Source:\n{}\n\n'.format(code_block(details['source']))
    if '--input' in opts:
    # Combine program output and runtime error output.
        head += 'Input:\n{}\n\n'.format(code_block(details['input']))
    output = details['output'] + details['stderr']
    # Truncate the output if it contains an excessive
    # amount of line breaks or if it is too long.
    if output.count('\n') > LINE_LIMIT:
        lines = output.split('\n')
        # If message contains an excessive amount of duplicate lines,
        # truncate to a small amount of lines to discourage spamming
        if len(set(lines)) < 5:
            lines_allowed = 2
        else:
            lines_allowed = 51
        output = '\n'.join(lines[:lines_allowed])
        output += "\n..."
    # Truncate the output if it is too long.
    if len(output) > 8000:
        output = output[:8000] + '\n    ...\n'
    body += 'Output:\n{}\n\n'.format(code_block(output))
    if details['cmpinfo']:
        body += 'Compiler Info:\n{}\n\n'.format(code_block(details['cmpinfo']))
    # Combine extra runtime information.
    if '--date' in opts:
        extra += "Date: {}\n\n".format(details['date'])
    if '--memory' in opts:
        extra += "Memory Usage: {} bytes\n\n".format(details['memory'])
    if '--time' in opts:
        extra += "Execution Time: {} seconds\n\n".format(details['time'])
    if opts in '--version':
        extra += "Version: {}\n\n".format(details['langVersion'])
    # To ensure the reply is less than 10000 characters long, shorten
    # sections of the reply until they are of adequate length. Certain
    # sections with less priority will be shortened before others.
    total_len = 0
    for section in (FOOTER, body, head, extra):
        if len(section) + total_len > 9800:
            section = section[:9800 - total_len] + '\n...\n'
            total_len += len(section)
    reply_text = head + body + extra
    return reply_text
dataset/ETHPy150Open renfredxh/compilebot/compilebot/compilebot.py/format_reply/swapped operands of `in`