Implements clamp in Python. Pre-alpha version - API subject to change.