def hex_to_bytes(hex_str):
    """
    Convert a string hex byte values into a byte string.

    The hex byte values may or may not be space separated.
    """
    bytes_ = []

    hex_str = ''.join(hex_str.split(" "))

    for i in range(0, len(hex_str), 2):
        bytes_.append(chr(int(hex_str[i:i + 2], 16)))

    return ''.join(bytes_)