Full code on github.
pip install samplehost
import samplehost print(samplehost.clean_string(" Hello World! ")) # 'Hello World!'