def raise_for_file_corruption(file_name, expected_file_size, error):
    'Raise an error if file does not pass integrity check.'
    actual_file_size = os.path.getsize(file_name)
    if (expected_file_size != actual_file_size):
        error(f"File's ({file_name}) expected size ({expected_file_size}) does not match its actual size ({actual_file_size})")
    if (file_name.split('.')[(- 1)] == 'gz'):
        try:
            with gzip.open(file_name, 'rb') as f:
                chunk_size = ((1024 * 1024) * 10)
                while bool(f.read(chunk_size)):
                    pass
        except OSError:
            error(f'File {file_name} did not pass gzip integrity check')
Raise an error if file does not pass integrity check.
def raise_for_file_corruption(file_name, expected_file_size, error):
    
    actual_file_size = os.path.getsize(file_name)
    if (expected_file_size != actual_file_size):
        error(f"File's ({file_name}) expected size ({expected_file_size}) does not match its actual size ({actual_file_size})")
    if (file_name.split('.')[(- 1)] == 'gz'):
        try:
            with gzip.open(file_name, 'rb') as f:
                chunk_size = ((1024 * 1024) * 10)
                while bool(f.read(chunk_size)):
                    pass
        except OSError:
            error(f'File {file_name} did not pass gzip integrity check')