added function to encapsulate blockopened and blockclosed calls

example of psake task