def common_path(path1, path2, common=[]):
    """ Compute the common part of two paths *path1* and *path2* """
    if len(path1) < 1: 
        return (common, path1, path2)
    if len(path2) < 1: 
        return (common, path1, path2)
    if path1[0] != path2[0]: 
        return (common, path1, path2)
    return common_path(path1[1:], path2[1:], common + [path1[0]])