def METHOD_NAME(patch, accept_prefix, replace_prefix):
    assert accept_prefix[0] != b'/'
    assert replace_prefix[0] != b'/'
    full_accept_prefix = GIT_FILE_SECTION_MARKER + b" a/" + accept_prefix
    with open(patch, "rb") as f:
        content = f.readlines()
    clean_content = []
    do_skip = False
    for line in content:
        if line.startswith(GIT_SUBJECT_COMMON_PREFIX):
            # Skip possible prefix like "Cycles:", we already know change is
            # about Cycles since it's being committed to a Cycles repository.
            line = subject_strip(GIT_SUBJECT_COMMON_PREFIX, line)
            # Dots usually are omitted in the topic
            line = line.replace(b".\n", b"\n")
        elif line.startswith(GIT_FILE_SECTION_MARKER):
            if not line.startswith(full_accept_prefix):
                do_skip = True
            else:
                do_skip = False
                line = replace_file_prefix(line, accept_prefix, replace_prefix)
        elif line.startswith(GIT_PATCHSET_END_MARKER):
            do_skip = False
        elif line.startswith(b"---") or line.startswith(b"+++"):
            line = replace_file_prefix(line, accept_prefix, replace_prefix)
        if not do_skip:
            clean_content.append(line)
    with open(patch, "wb") as f:
        f.writelines(clean_content)