def METHOD_NAME(label_map_path, use_display_name=False):
    """Reads a label map and returns a dictionary of label names to id.
    Args:
      label_map_path: path to label_map.
      use_display_name: whether to use the label map items' display names as keys.
    Returns:
      A dictionary mapping label names to id.
    """
    label_map = load_labelmap(label_map_path)
    label_map_dict = {}
    for item in label_map.item:
        if use_display_name:
            label_map_dict[item.display_name] = item.id
        else:
            label_map_dict[item.name] = item.id
    return label_map_dict