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