def synchronized(func):
    """
    This decorator will run the function body only if the attribute
    ``synchronized`` of the current object is set.
    """
    def wrapper(*args):
        if args[0].synchronized:
            return func(*args)

    return wrapper