import typing
import hashlib


def sha512(data: typing.Optional[bytes] = None):
    """Returns a sha512 hash object; optionally initialized with a string."""

    if data is None:
        return hashlib.sha512()
    return hashlib.sha512(data)