def CalculateNewPassRate(existing_pass_rate, existing_iterations,
                         incoming_pass_rate, incoming_iterations):
  """Incorporates a new pass rate into an exsting one.

  Args:
    existing_pass_rate (float): The pass rate to merge into.
    exisitng_iterations (int): The number of iterations used to calculate the
        existing pass rate.
    incoming_pass_rate (float): The new pass rate to incorporate.
    incoming_iterations (int): The number of iterations used to calculate the
        incoming pass rate.

  Returns:
    (float): The new combined pass rate.
  """
  existing_pass_count = existing_pass_rate * existing_iterations
  incoming_pass_count = incoming_pass_rate * incoming_iterations

  return float(existing_pass_count + incoming_pass_count) / (
      existing_iterations + incoming_iterations)