def shorten_path(path):
    """Shorten an incoming domain name like path to
       only have the first char of each segment except the last
       e.g. foo.bar.baz -> f.b.baz
     """
    out = ""
    segments = path.split(".")
    l = len(segments)
    i = 0
    while i < l:
        element = segments[i]
        if i < l-1:
            out = out + element[0]
            out = out + "."
        else:
            out = out + element
        i += 1

    return out