Implementation of the 'synchronized' keyword as a python decorator.