'Delete arcname, and put the bytes from filename into the
archive under the name arcname.'

def replace(self, filename, arcname=None, compress_type=None):

    deleteName = arcname
    if (deleteName is None):
        deleteName = filename
    self.delete(deleteName)
    self.write(filename, arcname, compress_type)
