How To Get Substring From String In Python Function