converting BOLD.m into a pyhton function