<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def linearize_metrics(logged_metrics):
 """ Group metrics by name. Takes a list of individual measurements, possibly belonging to different metrics and groups them by name. :param logged_metrics: A list of ScalarMetricLogEntries :return: Measured values grouped by the metric name: {"metric_name1": {"steps": [0,1,2], "values": [4, 5, 6], "timestamps": [datetime, datetime, datetime]}, """

    metrics_by_name = {}
    for metric_entry in logged_metrics:
        if metric_entry.name not in metrics_by_name:
            metrics_by_name[metric_entry.name] = {
                "steps": [],
                "values": [],
                "timestamps": [],
                "name": metric_entry.name
            }
        metrics_by_name[metric_entry.name]["steps"] \
            .append(metric_entry.step)
        metrics_by_name[metric_entry.name]["values"] \
            .append(metric_entry.value)
        metrics_by_name[metric_entry.name]["timestamps"] \
            .append(metric_entry.timestamp)
    return metrics_by_name