import subprocess
code = """[x for x in ().__class__.__bases__[0].__subclasses__() 
           if x.__name__ == 'Popen'][0](['ls', '-la']).wait()"""
exec(code, dict(__builtins__=None))
disallow access to filesystem inside exec and eval in Python