<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def translate(output_handler: OutputHandler, trans_inputs: List[inference.TranslatorInput], translator: inference.Translator) -> float: """ Translates each line from source_data, calling output handler after translating a batch. :param output_handler: A handler that will be called once with the output of each translation. :param trans_inputs: A enumerable list of translator inputs. :param translator: The translator that will be used for each line of input. :return: Total time taken. """

    tic = time.time()
    trans_outputs = translator.translate(trans_inputs)
    total_time = time.time() - tic
    batch_time = total_time / len(trans_inputs)
    for trans_input, trans_output in zip(trans_inputs, trans_outputs):
        output_handler.handle(trans_input, trans_output, batch_time)
    return total_time