code: def serialized(f):
      
      import functools
  
      @functools.wraps(f)
      def wrapper(*args, **kwargs):
          with _lock:
              return f(*args, **kwargs)
      if not hasattr(wrapper, '__wrapped__'):
          # Workaround for Python < 3.2
          wrapper.__wrapped__ = f
      return wrapper
docs: Decorator that serializes access to all decorated functions.
  
      The decorator acquires pyspotify's single global lock while calling any
      wrapped function. It is used to serialize access to:
  
      - All calls to functions on :attr:`spotify.lib`.
  
      - All code blocks working on pointers returned from functions on
        :attr:`spotify.lib`.
  
      - All code blocks working on other internal data structures in pyspotify.
  
      Together this is what makes pyspotify safe to use from multiple threads and
      enables convenient features like the :class:`~spotify.EventLoop`.
  
      Internal function.