def update_metrics(server_metrics, client_metrics, weight=1):
    """
    ## Description:

    It updates the value of the metric stored in `server_metrics` with the value of the metrics contained in `client_metrics`, by performing a weighted average.

    ## Args:

    `server_metrics`: (dict)
    The metrics to be updated

    `client_metrics`: (dict)
    The metrics received from the client to use to update the ones stored in `server_metrics`

    `weight`: (float)
    The weight associated to the metrics in `client_metrics`. 

    ## Returns:

    `server_metrics`: (dict)
    The updated metrics
    """
    if len(server_metrics) == 0:
        for metric, value in client_metrics.items():
            server_metrics[metric] = value * weight
    else:
        for metric, value in client_metrics.items():
            server_metrics[metric] += value * weight
    return server_metrics