code: def get_path(item):
      
      sanitizers = [group_sanitizer, label_sanitizer]
      if isinstance(item, tuple):
          path, item = item
          if item.label:
              if len(path) > 1 and item.label == path[1]:
                  path = path[:2]
              else:
                  path = path[:1] + (item.label,)
          else:
              path = path[:1]
      else:
          path = (item.group, item.label) if item.label else (item.group,)
      return tuple(capitalize(fn(p)) for (p, fn) in zip(path, sanitizers))
docs: Gets a path from an Labelled object or from a tuple of an existing
      path and a labelled object. The path strings are sanitized and
      capitalized.