def feat_n_cnt(s, sep=':'):
    """Read feature and count from a string in format of "feature:count".

    Parameters
    ----------
    s : str
        Input string.
    sep : str, optional
        Separator between feature and count (default: colon).

    Returns
    -------
    tuple of (str, int)
        Pair of feature and count.
    """
    # find first occurrence of separator from right
    key, _, value = s.rpartition(sep)

    # if separator is found
    if key:

        # part after separator is number
        try:
            n = int(value)

        # otherwise, entire string is feature
        except ValueError:
            return s, 1

        # count must be positve integer
        if n > 0:
            return key, n

        # otherwise, entire string is feature
        else:
            return s, 1

    # no separator: entire string is feature
    else:
        return s, 1