from typing import Union
import hashlib


def etag(content: Union[str, bytes]) -> str:
    """Calculate a unique ETag for the provided content.

    Parameters
    ----------
    content : Union[str, bytes]
        Content for which the etag should be calculated.

    Returns
    -------
    str
        Calculated etag.
    """
    if isinstance(content, str):
        content = content.encode("utf-8")
    return hashlib.sha256(content).hexdigest()