code: def query_context(self, regions, file_factory=PythonFile):
          
          result = set()
  
          for region in regions:
              try:
                  pf = file_factory(region.filename)
              except InvalidPythonFile:
                  continue
  
              # region and/or coverage report may use paths
              # relative to this directory. Ensure we find a match
              # if they use different conventions.
              paths = {
                  os.path.abspath(region.filename),
                  os.path.relpath(region.filename)
              }
              for test_context, hits in six.iteritems(self.data):
                  if test_context in result:
                      continue
  
                  for path in paths:
                      if region.intersects(pf, hits.get(path, [])):
                          result.add(test_context)
  
          return QueryResult(result)
docs: Return which set of test contexts intersect a set of code regions.
  
  
          Parameters
          ----------
          regions: A sequence of Intervals
  
          file_factory: Callable (optional, default PythonFile)
              A callable that takes a filename and
              returns a PythonFile object.
  
          Returns
          -------
          A QueryResult