def remove_triple_quotes(sql_query): print('the incoming sql_query is :\n', sql_query) if sql_query.startswith('"""') and sql_query.endswith('"""'): sql_query = sql_query[3:-3].strip() print('the outgoing sql_query is :\n', sql_query) return sql_query elif sql_query.startswith("'''") and sql_query.endswith("'''"): sql_query = sql_query[3:-3].strip() print('the outgoing sql_query is :\n', sql_query) return sql_query elif sql_query.startswith("```") and sql_query.endswith("```"): sql_query = sql_query[3:-3].strip() print('the outgoing sql_query is :\n', sql_query) return sql_query else: print('the outgoing sql_query is :\n', sql_query) return sql_query