Use ast module instead of regex to parse Python files