import time


def write(client, data, dst, write_type, timer):
    """Write the {src} file in the local filesystem to the {dst} file in Alluxio.

    Args:
        client (:class:`alluxio.Client`): Alluxio client.
        data (str): The file content of the source.
        dst (str): The file to be written to Alluxio.
        write_type (:class:`alluxio.wire.WriteType`): Write type for creating the file.
        timer (:class:`multiprocessing.Value`): Timer for summing up the total time for writing the files.

    Returns:
        float: writing time
    """

    start_time = time.time()
    with client.open(dst, 'w', recursive=True, write_type=write_type) as alluxio_file:
        alluxio_file.write(data)
    elapsed_time = time.time() - start_time
    with timer.get_lock():
        timer.value += elapsed_time
    return elapsed_time