<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compute_for_file(self, file, block_size=2**14):
 """Compute hash digests for a file. Calculate the hashes based on one read through the file. Optional block_size parameter controls memory used to do calculations. This should be a multiple of 128 bytes. """

        self.initialize_hashes()
        f = open(file, 'rb')
        while True:
            data = f.read(block_size)
            if not data:
                break
            if (self.md5_calc is not None):
                self.md5_calc.update(data)
            if (self.sha1_calc is not None):
                self.sha1_calc.update(data)
            if (self.sha256_calc is not None):
                self.sha256_calc.update(data)
        f.close()