import copy # Make deep copies of arguments to mimic behaviour of strongly typed languages. # https://stackoverflow.com/a/15398021 def llm_by_value(f): def _f(*args, **kwargs): argsCopy = copy.deepcopy(args) kwargsCopy = copy.deepcopy(kwargs) return f(*argsCopy, **kwargsCopy) return _f