def tail(filename, n):
size = os.path.getsize(filename)<EOL>with open(filename, "<STR_LIT:rb>") as f:<EOL><INDENT>fm = mmap.mmap(f.fileno(), <NUM_LIT:0>, mmap.MAP_SHARED, mmap.PROT_READ)<EOL>try:<EOL><INDENT>for i in range(size - <NUM_LIT:1>, -<NUM_LIT:1>, -<NUM_LIT:1>):<EOL><INDENT>if fm[i] == '<STR_LIT:\n>':<EOL><INDENT>n -= <NUM_LIT:1><EOL>if n == -<NUM_LIT:1>:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>return fm[i + <NUM_LIT:1> if i else <NUM_LIT:0>:].splitlines()<EOL><DEDENT>finally:<EOL><INDENT>fm.close()<EOL><DEDENT><DEDENT>
Returns last n lines from the filename. No exception handling