Try this code:
import re
p = re.compile(r'^[0123456789abcdef\s]+$')
str = "0000 006e 0022 0002 0156 00ac 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0041 0016 05e0 0156 0055 0016 0e41"
if(p.match(str)):
print("passed")
else:
list = re.findall('([^0123456789abcdef\s])+', str)
print(list)
It will search in the string for the 0123456789abcdef\s
occurrences. If some character is not in this pattern, then it won't pass
EDIT:
Increased the code in case it won't pass, will print all the occurrences which are invalid