<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pick_env_and_run_and_report(self, env: env_tools.PreparedEnv, env_py2: Optional[env_tools.PreparedEnv], verbose: bool, previous_failures: Set['Check'] ) -> CheckResult: """Evaluates this check in python 3 or 2.7, and reports to github. If the prepared environments are not linked to a github repository, with a known access token, reporting to github is skipped. Args: env: A prepared python 3 environment. env_py2: A prepared python 2.7 environment. verbose: When set, more progress output is produced. previous_failures: Checks that have already run and failed. Returns: A CheckResult instance. """

        env.report_status_to_github('pending', 'Running...', self.context())
        chosen_env = cast(env_tools.PreparedEnv,
                          env_py2 if self.needs_python2_env() else env)
        os.chdir(cast(str, chosen_env.destination_directory))

        result = self.run(chosen_env, verbose, previous_failures)

        if result.unexpected_error is not None:
            env.report_status_to_github('error',
                                        'Unexpected error.',
                                        self.context())
        else:
            env.report_status_to_github(
                'success' if result.success else 'failure',
                result.message,
                self.context())

        return result