def _make_headermap_input_file(namespace, hdrs, flatten_headers):
    """Create a string representing the mappings from headers to their
    namespaced include versions. The format is

    virtual_header_path|real_header_path

    Note the separator is a pipe character.

    :param namespace: 'foo' in #include <foo/bar.h>
    :param hdrs: list of header that need to be mapped
    :param flatten_headers: boolean value that if set, will "flatten"
           the virtual heders. What this means is that the headers
           will also be added without the namespace or any paths
           (basename).

    :return: string with all the headers in the above mentioned
    format. This can be saved to a file and read by the hmapbuild tool
    included here to create a header map file.

    """
    entries = []
    for hdr in hdrs:
        namespaced_key = namespace + "/" + hdr.basename
        entries.append("{}|{}".format(hdr.basename, hdr.path))
        if flatten_headers:
            entries.append("{}|{}".format(namespaced_key, hdr.path))
    return "\n".join(entries) + "\n"