<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def synchronized(*args):
 """A synchronized function prevents two or more callers to interleave its execution preventing race conditions. The synchronized decorator accepts as optional parameter a Lock, RLock or Semaphore object which will be employed to ensure the function's atomicity. If no synchronization object is given, a single threading.Lock will be used. This implies that between different decorated function only one at a time will be executed. """

    if callable(args[0]):
        return decorate_synchronized(args[0], _synchronized_lock)
    else:
        def wrap(function):
            return decorate_synchronized(function, args[0])

        return wrap