Ref : https://github.com/python/cpython/pull/25174

https://github.com/localstack/localstack/blob/5a5edcd9d9ccbd6a56f23d71e3a1131b8c814996/localstack/utils/common.py#L324
return self._stream_value(self._stdout)
    def stderr(self):
        return self._stream_value(self._stderr)
    def _stream_value(self, stream):
        return stream.getvalue() if hasattr(stream, 'getvalue') else stream
def start_thread(method, *args, **kwargs):
    _shutdown_hook = kwargs.pop('_shutdown_hook', True)
    thread = FuncThread(method, *args, **kwargs)
    thread.start()
    if _shutdown_hook:
        TMP_THREADS.append(thread)
    return thread
def start_worker_thread(method, *args, **kwargs):
    return start_thread(method, *args, _shutdown_hook=False, **kwargs)
def empty_context_manager():
    import contextlib
    return contextlib.nullcontext()
def synchronized(lock=None):
    """
    Synchronization decorator as described in
    http://blog.dscpl.com.au/2014/01/the-missing-synchronized-decorator.html.
    """
    def _decorator(wrapped):
        @functools.wraps(wrapped)
        def _wrapper(*args, **kwargs):
            with lock:
                return wrapped(*args, **kwargs)
        return _wrapper
    return _decorator
def prevent_stack_overflow(match_parameters=False):