code: def RunValidation(feed, options, problems):
    
    util.CheckVersion(problems, options.latest_version)
  
    # TODO: Add tests for this flag in testfeedvalidator.py
    if options.extension:
      try:
        __import__(options.extension)
        extension_module = sys.modules[options.extension]
      except ImportError:
        # TODO: Document extensions in a wiki page, place link here
        print("Could not import extension %s! Please ensure it is a proper "
              "Python module." % options.extension)
        exit(2)
    else:
      extension_module = transitfeed
  
    gtfs_factory = extension_module.GetGtfsFactory()
  
    print('validating %s' % feed)
    print('FeedValidator extension used: %s' % options.extension)
    loader = gtfs_factory.Loader(feed, problems=problems, extra_validation=False,
                                 memory_db=options.memory_db,
                                 check_duplicate_trips=\
                                 options.check_duplicate_trips,
                                 gtfs_factory=gtfs_factory)
    schedule = loader.Load()
    # Start validation: children are already validated by the loader.
    schedule.Validate(service_gap_interval=options.service_gap_interval,
                      validate_children=False)
  
    if feed == 'IWantMyvalidation-crash.txt':
      # See tests/testfeedvalidator.py
      raise Exception('For testing the feed validator crash handler.')
  
    accumulator = problems.GetAccumulator()
    if accumulator.HasIssues():
      print('ERROR: %s found' % accumulator.FormatCount())
      return schedule, 1
    else:
      print('feed validated successfully')
      return schedule, 0
docs: Validate feed, returning the loaded Schedule and exit code.
  
    Args:
      feed: GTFS file, either path of the file as a string or a file object
      options: options object returned by optparse
      problems: transitfeed.ProblemReporter instance
  
    Returns:
      a transitfeed.Schedule object, exit code and plain text string of other
      problems
      Exit code is 2 if an extension is provided but can't be loaded, 1 if
      problems are found and 0 if the Schedule is problem free.
      plain text string is '' if no other problems are found.