def sort_card_indices(cards, indices, ranks=None):
    ranks = ranks or DEFAULT_RANKS
    if ranks.get("suits"):
        indices = sorted(
            indices,
            key=lambda x: ranks["suits"][cards[x].suit] if
                cards[x].suit != None else 0
        )
    if ranks.get("values"):
        indices = sorted(
            indices,
            key=lambda x: ranks["values"][cards[x].value]
        )
    return indices