Cannot Resolve Method Replace Python Syntax Error