Provoide a trust environment for python like programming language, like RestrictedPython.
Likepy is a library that helps to exec or eval the following python-like languages within a trusted environment:
:warning: Likepy only supports CPython. It does not support PyPy and other Python implementations.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.