from typing import Union
import hmac
import hashlib


def hmac_sha1(content: Union[str, bytes, bytearray, memoryview], key: bytes = b'') -> str:
    """
    sha1 encrypt with hmac

    :param content: words
    :param key: secret
    :return: encrypted words
    """
    if isinstance(content, str):
        content = content.encode()
    m = hmac.new(key, content, digestmod=hashlib.sha1)
    return m.hexdigest()