def pi_revision():
<EOL>with open('<STR_LIT>', '<STR_LIT:r>') as infile:<EOL><INDENT>for line in infile:<EOL><INDENT>match = re.match('<STR_LIT>', line, flags=re.IGNORECASE)<EOL>if match and match.group(<NUM_LIT:1>) in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>elif match:<EOL><INDENT>return <NUM_LIT:2><EOL><DEDENT><DEDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>
Detect the revision number of a Raspberry Pi, useful for changing
    functionality like default I2C bus based on revision.