def METHOD_NAME(self, filename):
    """
    Parse a sitemap file.
    Args:
        filename: str, the path to the sitemap file.
    Returns:
        Sitemap: the generated sitemap.
    """
    with io.open(filename, 'r', encoding='utf-8') as _:
        lines = _.readlines()
    all_source_files = set()
    source_map = {}
    lineno = 0
    root = None
    index = None
    cur_level = -1
    parent_queue = []
    for line in lines:
        try:
            level, line = dedent(line)
            if line.startswith('#'):
                lineno += 1
                continue
            elif line.startswith('\\#'):
                line = line[1:]
        except IndentError as exc:
            error('bad-indent', 'Invalid indentation', filename=filename,
                  lineno=lineno, column=exc.column)
        if not line:
            lineno += 1
            continue
        source_file = dequote(line)
        if not source_file:
            lineno += 1
            continue
        if source_file in all_source_files:
            error('sitemap-duplicate', 'Filename listed twice',
                  filename=filename, lineno=lineno, column=level * 8 + 1)
        all_source_files.add(source_file)
        source_map[source_file] = (lineno, level * 8 + 1)
        page = OrderedDict()
        if root is not None and level == 0:
            error('sitemap-error', 'Sitemaps only support one root',
                  filename=filename, lineno=lineno, column=0)
        if root is None:
            root = page
            index = source_file
        else:
            lvl_diff = cur_level - level
            while lvl_diff >= 0:
                parent_queue.pop()
                lvl_diff -= 1
            parent_queue[-1][source_file] = page
        parent_queue.append(page)
        cur_level = level
        lineno += 1
    return Sitemap(root, filename, index, source_map)