def METHOD_NAME(
    self,
    measurement: Optional[vz.Measurement] = None,
    *,
    infeasible_reason: Optional[str] = None,
) -> Optional[vz.Measurement]:
    """Completes the trial and #materializes the measurement.
    * If `measurement` is provided, then Vizier writes it as the trial's final
    measurement and returns it.
    * If `infeasible_reason` is provided, `measurement` is not needed.
    * If neither is provided, then Vizier selects an existing (intermediate)
    measurement to be the final measurement and returns it.
    Args:
      measurement: Final measurement.
      infeasible_reason: Infeasible reason for missing final measurement.
    Returns:
      The final measurement of the trial, or None if the trial is marked
      infeasible.
    Raises:
      ValueError: If neither `measurement` nor `infeasible_reason` is provided
        but the trial does not contain any intermediate measurements.
    """