def file_cmp(fp1, fp2, bufsize=8 * 1024):
    """ Like filecmp.cmp except arguments are file-like objects instead of file names """
    while True:
        b1 = fp1.read(bufsize)
        b2 = fp2.read(bufsize)
        if b1 != b2:
            return False
        if not b1:
            return True
