code: def write_bytes(self, bytes, append=False):
          
          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)
docs: 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.