code: def unmatched_quotes_in_line(text):
      
      # We check " first, then ', so complex cases with nested quotes will
      # get the " to take precedence.
      text = text.replace("\\'", "")
      text = text.replace('\\"', '')
      if text.count('"') % 2:
          return '"'
      elif text.count("'") % 2:
          return "'"
      else:
          return ''
docs: Return whether a string has open quotes.
  
      This simply counts whether the number of quote characters of either
      type in the string is odd.
  
      Take from the IPython project (in IPython/core/completer.py in v0.13)
      Spyder team: Add some changes to deal with escaped quotes
  
      - Copyright (C) 2008-2011 IPython Development Team
      - Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
      - Copyright (C) 2001 Python Software Foundation, www.python.org
  
      Distributed under the terms of the BSD License.