<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _read_metrics(repo, metrics, branch):
 """Read the content of each metric file and format it. Args: metrics (list):
 List of metric touples branch (str):
 Branch to look up for metrics. Returns: A dict mapping keys with metrics path name and content. For example: {'metric.csv': ("value_mse deviation_mse data_set\n" "0.421601 0.173461 train\n" "0.67528 0.289545 testing\n" "0.671502 0.297848 validation\n")} """

    res = {}
    for out, typ, xpath in metrics:
        assert out.scheme == "local"
        if not typ:
            typ = os.path.splitext(out.path.lower())[1].replace(".", "")
        if out.use_cache:
            open_fun = open
            path = repo.cache.local.get(out.checksum)
        else:
            open_fun = repo.tree.open
            path = out.path
        try:

            with open_fun(path) as fd:
                metric = _read_metric(
                    fd,
                    typ=typ,
                    xpath=xpath,
                    rel_path=out.rel_path,
                    branch=branch,
                )
        except IOError as e:
            if e.errno == errno.ENOENT:
                logger.warning(
                    NO_METRICS_FILE_AT_REFERENCE_WARNING.format(
                        out.rel_path, branch
                    )
                )
                metric = None
            else:
                raise

        if not metric:
            continue

        res[out.rel_path] = metric

    return res