human
Complete this python program:
def apply_to_binary_file(f):
assistant
#Here is the Python program you requested.

    """Apply a filter to a binary file.
    Take a function f that transforms a data argument, and returns
    a function that takes a filename and applies f to the contents,
    in place.  Reads files in binary mode.
    """
    @wraps(f)
    def f_in_file(fname, *args, **kwargs):
        with open(fname, 'rb') as inf:
            data = inf.read()
        data = f(data, *args, **kwargs)
        with open(fname, 'wb+') as outf:
            outf.write(data)
    return f_in_file