code: def is_quoted(position, text):
      
      def matching(quotemark1, quotemark2):
          straight = '\"\''
          curly = '“”'
          if quotemark1 in straight and quotemark2 in straight:
              return True
          if quotemark1 in curly and quotemark2 in curly:
              return True
          else:
              return False
  
      def find_ranges(text):
          s = 0
          q = pc = ''
          start = None
          ranges = []
          seps = " .,:;-\r\n"
          quotes = ['\"', '“', '”', "'"]
          for i, c in enumerate(text + "\n"):
              if s == 0 and c in quotes and pc in seps:
                  start = i
                  s = 1
                  q = c
              elif s == 1 and matching(c, q):
                  s = 2
              elif s == 2:
                  if c in seps:
                      ranges.append((start+1, i-1))
                      start = None
                      s = 0
                  else:
                      s = 1
              pc = c
          return ranges
  
      def position_in_ranges(ranges, position):
          for start, end in ranges:
              if start <= position < end:
                  return True
          return False
  
      return position_in_ranges(find_ranges(text), position)
docs: Determine if the position in the text falls within a quote.