Problem caching Matplotlib Plots with Lock

We are trying to cach the rendering of matplotlib plots to improve the performance. The App has to be
accessible for multiple users at the same time, that is why RendererAgg.lock is used to fix matplotlib’s problem with multithreading. To prevent Streamlit from usings it’s hashing function we used “hash_funcs : lambda _: None”. The problem lies with the type of the lock and the hashing because even though hash_funcs is used there are errors.

Errormessage: 
AttributeError: '_thread.RLock' object has no attribute '__module__'
Traceback:
File "/Users/name/opt/anaconda3/envs/mne/lib/python3.8/site-packages/streamlit/script_runner.py", line 332, in _run_script
    exec(code, module.__dict__)
File "/Users/name/project/streamlit_mne_demo/streamlit_app.py", line 50, in <module>
    def plotEEG(eeg):
File "/Users/name/opt/anaconda3/envs/mne/lib/python3.8/site-packages/streamlit/caching.py", line 452, in <lambda>
    return lambda f: cache(
File "/Users/name/opt/anaconda3/envs/mne/lib/python3.8/site-packages/streamlit/caching.py", line 500, in cache
    update_hash(
File "/Users/name/opt/anaconda3/envs/mne/lib/python3.8/site-packages/streamlit/hashing.py", line 89, in update_hash
    ch = _CodeHasher(hash_funcs)
File "/Users/name/opt/anaconda3/envs/mne/lib/python3.8/site-packages/streamlit/hashing.py", line 259, in __init__
    self._hash_funcs = {​​​​​​​
File "/Users/name/opt/anaconda3/envs/mne/lib/python3.8/site-packages/streamlit/hashing.py", line 260, in <dictcomp>
    k if isinstance(k, str) else type_util.get_fqn(k): v
File "/Users/name/opt/anaconda3/envs/mne/lib/python3.8/site-packages/streamlit/type_util.py", line 52, in get_fqn
    module = the_type.__module__

Code: