'Running a single line/snippet in Python 3 and returning result to Python 2

What is the best way to execute a single-line of Python 3 and return the result to a Python 2 program. For example:

#!/usr/bin/env python2 
# Not valid code
pwsd = exec("python3 -c 'import crypt; print(crypt.crypt(\"<password_str>\",salt=crypt.METHOD_SHA512))'")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source