def sort_like(l, col1, col2):
    '''
    Sorts the list :py:obj:`l` by comparing :py:obj:`col2` to :py:obj:`col1`.
    Specifically, finds the indices :py:obj:`i` such that ``col2[i] = col1``
    and returns ``l[i]``. This is useful when comparing the CDPP values of
    catalogs generated by different pipelines. The
    target IDs are all the same, but won't necessarily be in the same order.
    This allows :py:obj:`everest` to sort the CDPP arrays so that the
    targets match.

    :param array_like l: The list or array to sort
    :param array_like col1: A list or array (same length as :py:obj:`l`)
    :param array_like col2: A second list or array containing the same \
           elements as :py:obj:`col1` but in a different order

    '''

    s = np.zeros_like(col1) * np.nan
    for i, c in enumerate(col1):
        j = np.argmax(col2 == c)
        if j == 0:
            if col2[0] != c:
                continue
        s[i] = l[j]
    return s
def sort_like ( l , col1 , col2 ) : s = np . zeros_like ( col1 ) * np . nan for i , c in enumerate ( col1 ) : j = np . argmax ( col2 == c ) if j == 0 : if col2 [ 0 ] != c : continue s [ i ] = l [ j ] return s
Sorts the list :py:obj:`l` by comparing :py:obj:`col2` to :py:obj:`col1`.
    Specifically, finds the indices :py:obj:`i` such that ``col2[i] = col1``
    and returns ``l[i]``. This is useful when comparing the CDPP values of
    catalogs generated by different pipelines. The
    target IDs are all the same, but won't necessarily be in the same order.
    This allows :py:obj:`everest` to sort the CDPP arrays so that the
    targets match.

    :param array_like l: The list or array to sort
    :param array_like col1: A list or array (same length as :py:obj:`l`)
    :param array_like col2: A second list or array containing the same \
           elements as :py:obj:`col1` but in a different order