For anyone else who sees this thread, the most likely cause of a python syntax error at the beginning of a line like that is that there is something incomplete about the previous line. Typically a missing close parenthesis or close bracket.
If you have a hard time finding a syntax error, that probably means you are looking in the wrong place.