import hashlib


def generate_hash(file_name, hash_algo="sha256"):
    """
    Generate a hash for the provided file path.
    :param file_name: The path to the file for which to generate a hash.
    :param hash_algo: The hash algorithm to use.
    :return: The generated hash.
    :rtype: str
    """
    hasher = getattr(hashlib, hash_algo, None)
    if hasher is None:
        raise ValueError("Unknown hash algorithm '{}'.".format(hash_algo))
    with open(file_name, "rb") as file:
        hasher.update(file.read())
        file_hash = hasher.hexdigest()
        return file_hash