import re


def b(hex_str):
    """
    Convenience function to convert even-length hex string (excluding 0x) to bytes object
    """
    assert type(hex_str) is str
    assert re.match('^([0-9a-fA-F]{2})*$', hex_str) is not None, 'Not a valid string of hex octets'
    return bytes.fromhex(hex_str)