def get_hash(file_path, checksum='<STR_LIT>'):
sha = getattr(hashlib, checksum)()<EOL>with open(file_path) as file_descriptor:<EOL><INDENT>while True:<EOL><INDENT>chunk = file_descriptor.read(<NUM_LIT>)<EOL>if not chunk:<EOL><INDENT>break<EOL><DEDENT>sha.update(chunk)<EOL><DEDENT><DEDENT>return sha.hexdigest()<EOL>
Generate a hash for the given file

Args:
    file_path (str): Path to the file to generate the hash for
    checksum (str): hash to apply, one of the supported by hashlib, for
        example sha1 or sha512

Returns:
    str: hash for that file