code: def _find_last_good_run(build):
      
      run_name = request.form.get('run_name', type=str)
      utils.jsonify_assert(run_name, 'run_name required')
  
      last_good_release = (
          models.Release.query
          .filter_by(
              build_id=build.id,
              status=models.Release.GOOD)
          .order_by(models.Release.created.desc())
          .first())
  
      last_good_run = None
  
      if last_good_release:
          logging.debug('Found last good release for: build_id=%r, '
                        'release_name=%r, release_number=%d',
                        build.id, last_good_release.name,
                        last_good_release.number)
          last_good_run = (
              models.Run.query
              .filter_by(release_id=last_good_release.id, name=run_name)
              .first())
          if last_good_run:
              logging.debug('Found last good run for: build_id=%r, '
                            'release_name=%r, release_number=%d, '
                            'run_name=%r',
                            build.id, last_good_release.name,
                            last_good_release.number, last_good_run.name)
  
      return last_good_release, last_good_run
docs: Finds the last good release and run for a build.