def valid_checksum(file, hash_file):
bits = <NUM_LIT><EOL>hash_md5 = hashlib.md5()<EOL>with open(file, "<STR_LIT:rb>") as f:<EOL><INDENT>for chunk in iter(lambda: f.read(bits), b"<STR_LIT>"):<EOL><INDENT>hash_md5.update(chunk)<EOL><DEDENT><DEDENT>with open(hash_file) as c:<EOL><INDENT>for line in c.readlines():<EOL><INDENT>if line.strip():<EOL><INDENT>check_list = line.split()<EOL>if file == check_list[<NUM_LIT:1>]:<EOL><INDENT>if check_list[<NUM_LIT:0>] == hash_md5.hexdigest():<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return False<EOL>
Summary:
    Validate file checksum using md5 hash
Args:
    file: file object to verify integrity
    hash_file:  md5 reference checksum file
Returns:
    Valid (True) | False, TYPE: bool