import hashlib


def calculate_hash(file_path: str, block_size: int = 10240, hash_content=True):
    """
    Helper function that calculates the hash of a file/folder.
    If the given path is a folder: the hash of the string absolute path will be calculated
    If the given path is a file: the hash of the binary content will be calculated
    :param file_path: complete path to file with extension
    :param block_size:
    :param hash_content: Hash the file content (True) or the file_path string (False)
    :return: 
    """
    hash_sum = hashlib.md5()

    if not hash_content:
        hash_sum.update(file_path.encode())
    else:
        with open(file_path, "rb") as f:
            for block in iter(lambda: f.read(block_size), b""):
                hash_sum.update(block)

    return hash_sum.hexdigest()