Regex Replace Substring Python Function