Использовать тройные кавычки:
""" This 'string' contains "both" types of quote """ ''' So ' does " this '''