Python Get Specific Substring Function