get total error contribution for component with specific tag

def getErrorComponent(result, tag):
    """get total error contribution for component with specific tag"""
    return math.sqrt(sum(
        (error*2)**2
        for (var, error) in result.error_components().items()
        if var.tag == tag
    ))