Open this file and write the given bytes to it.

        Default behavior is to overwrite any existing file.
        Call p.write_bytes(bytes, append=True) to append instead.

def write_bytes(self, bytes, append=False):
        """ Open this file and write the given bytes to it.

        Default behavior is to overwrite any existing file.
        Call p.write_bytes(bytes, append=True) to append instead.
        """
        def _write_bytes(bytes, append):
            if append:
                mode = 'ab'
            else:
                mode = 'wb'
            f = self.open(mode)
            try:
                f.write(bytes)
            finally:
                f.close()

        dry("write_bytes %s '%r...' append=%r" % (self, bytes[:20], append),
            _write_bytes, bytes, append)