code: def DetermineRunner(bbdir):
      '''Checks if the given directory is a buildbot worker or a master and
      returns the appropriate run function.'''
      try:
          import buildbot_worker.scripts.runner
          tacfile = os.path.join(bbdir, 'buildbot.tac')
  
          if os.path.exists(tacfile):
              with open(tacfile, 'r') as f:
                  contents = f.read()
                  if 'import Worker' in contents:
                      return buildbot_worker.scripts.runner.run
  
      except ImportError:
          # Use the default
          pass
  
      import buildbot.scripts.runner
      return buildbot.scripts.runner.ruf DetermineRunner(bbdir):
      '''Checks if the given directory is a buildbot worker or a master and
      returns the appropriate run function.'''
      try:
          import buildbot_worker.scripts.runner
          tacfile = os.path.join(bbdir, 'buildbot.tac')
  
          if os.path.exists(tacfile):
              with open(tacfile, 'r') as f:
                  contents = f.read()
                  if 'import Worker' in contents:
                      return buildbot_worker.scripts.runner.run
  
      except ImportError:
          # Use the default
          pass
  
      import buildbot.scripts.runner
      return buildbot.scripts.runner.run
docs: Checks if the given directory is a buildbot worker or a master and
      returns the appropriate run function.