import hashlib
import base64
dig = hmac.new('1234567890', msg=your_bytes_string, digestmod=hashlib.sha256
    ).digest()
base64.b64encode(dig).decode()
"""Nace+U3Az4OhN7tISqgs1vdLBHBEijWcBeCqL5xN9xg="""
Calculating a SHA hash with a string + secret key in python