def _get_ordering(actual, desired):
    """Find an ordering of indices so that desired[i] == actual[ordering[i]].

    Parameters
    ----------
    actual, desired : string, same length
        Two strings differring only in the permutation of their characters.

    Returns
    -------
    ordering : list of int
        A list of indices into `actual` such that
        ``desired[i] == actual[ordering[i]]``.

    Examples
    --------
    >>> actual = "XYCZT"
    >>> desired = "TZYXC"
    >>> _get_ordering(actual, desired)
    [4, 3, 1, 0, 2]
    """
    ordering = []
    for elem in desired:
        ordering.append(actual.find(elem))
    return ordering