def get_trial_results(trial):
    """Format results from a `orion.core.worker.trial.Trial` using standard structures."""
    results = dict()

    lie = trial.lie
    objective = trial.objective

    if lie:
        results["objective"] = lie.value
    elif objective:
        results["objective"] = objective.value
    else:
        results["objective"] = None

    results["constraint"] = [
        result.value for result in trial.results if result.type == "constraint"
    ]
    grad = trial.gradient
    results["gradient"] = tuple(grad.value) if grad else None

    return results