+def is_comment_or_space(token):
+ return isinstance(token, Comment) or \
+ token.ttype in (T.Comment, T.Comment.Single, T.Comment.Multiline,
+ T.Newline, T.Whitespace)
+
+
+def is_newline_statement(statement):
+ for token in statement.tokens[:]:
+ if token.ttype is not T.Newline:
+ return False
+ return True
+
+
+def escape_strings(token_list, dbname):
+ """Escape strings"""
+ for token in token_list.flatten():
+ if token.ttype is T.String.Single:
+ value = token.value[1:-1] # unquote by removing apostrophes
+ value = sqlrepr(value, dbname)
+ token.normalized = token.value = value
+
+