def delete_bytes(fobj, size, offset, BUFFER_SIZE=<NUM_LIT:2>**<NUM_LIT:16>):
locked = False<EOL>assert <NUM_LIT:0> < size<EOL>assert <NUM_LIT:0> <= offset<EOL>fobj.seek(<NUM_LIT:0>, <NUM_LIT:2>)<EOL>filesize = fobj.tell()<EOL>movesize = filesize - offset - size<EOL>assert <NUM_LIT:0> <= movesize<EOL>try:<EOL><INDENT>if movesize > <NUM_LIT:0>:<EOL><INDENT>fobj.flush()<EOL>try:<EOL><INDENT>import mmap<EOL>file_map = mmap.mmap(fobj.fileno(), filesize)<EOL>try:<EOL><INDENT>file_map.move(offset, offset + size, movesize)<EOL><DEDENT>finally:<EOL><INDENT>file_map.close()<EOL><DEDENT><DEDENT>except (ValueError, EnvironmentError, ImportError):<EOL><INDENT>locked = lock(fobj)<EOL>fobj.seek(offset + size)<EOL>buf = fobj.read(BUFFER_SIZE)<EOL>while buf:<EOL><INDENT>fobj.seek(offset)<EOL>fobj.write(buf)<EOL>offset += len(buf)<EOL>fobj.seek(offset + size)<EOL>buf = fobj.read(BUFFER_SIZE)<EOL><DEDENT><DEDENT><DEDENT>fobj.truncate(filesize - size)<EOL>fobj.flush()<EOL><DEDENT>finally:<EOL><INDENT>if locked:<EOL><INDENT>unlock(fobj)<EOL><DEDENT><DEDENT>
Delete size bytes of empty space starting at offset.

    fobj must be an open file object, open rb+ or
    equivalent. Mutagen tries to use mmap to resize the file, but
    falls back to a significantly slower method if mmap fails.