def load_type_hierarchy(filename):
    """Reads the type hierarchy from a TSV file.

    Note: The TSV file is assumed to have a header row.

    Args:
        filename: Name of TSV file.

    Returns:
        A tuple with a types dict and the max hierarchy depth.
    """
#     print('Loading type hierarchy from {}... '.format(filename), end='')
    types = {}
    max_depth = 0
    with open(filename, 'r') as tsv_file:
        next(tsv_file)  # Skip header row
        for line in tsv_file:
            fields = line.rstrip().split('\t')
            type_name, depth, parent_type = fields[0], int(fields[1]), fields[2]
            types[type_name] = {'parent': parent_type,
                                'depth': depth}
            max_depth = max(depth, max_depth)
#     print('{} types loaded (max depth: {})'.format(len(types), max_depth))
    return types, max_depth