def motifs_from_proto(motifs, is_one_dimensional=False):
    """
    Utility function to transform motif locations back to single dimension
    or multi-dimension location.

    Parameter
    ---------
    motifs : array_like
        The protobuf formatted array.
    is_one_dimensional : boolean
        A flag to indicate if the original locations should be 1D.

    Returns
    -------
    list :
        The transformed motif locations.
    """
    out = []
    for motif in motifs:
        tmp = {'motifs': [], 'neighbors': []}
        for location in motif.motifs:
            if is_one_dimensional:
                tmp['motifs'].append(location.row)
            else:
                tmp['motifs'].append((location.row, location.col))
        for neighbor in motif.neighbors:
            if is_one_dimensional:
                tmp['neighbors'].append(neighbor.row)
            else:
                tmp['neighbors'].append((neighbor.row, neighbor.col))
        out.append(tmp)
    return out
