<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_winner(trials):
 """Get winner trial of a job."""

    winner = {}
    # TODO: sort_key should be customized here
    sort_key = "accuracy"
    if trials and len(trials) > 0:
        first_metrics = get_trial_info(trials[0])["metrics"]
        if first_metrics and not first_metrics.get("accuracy", None):
            sort_key = "episode_reward"
        max_metric = float("-Inf")
        for t in trials:
            metrics = get_trial_info(t).get("metrics", None)
            if metrics and metrics.get(sort_key, None):
                current_metric = float(metrics[sort_key])
                if current_metric > max_metric:
                    winner["trial_id"] = t.trial_id
                    winner["metric"] = sort_key + ": " + str(current_metric)
                    max_metric = current_metric
    return winner