def sort_cards(cards, ranks=None):
    """
    Sorts a given list of cards, either by poker ranks, or big two ranks.

    :arg cards:
        The cards to sort.
    :arg dict ranks:
        The rank dict to reference for sorting. If ``None``, it will
        default to ``DEFAULT_RANKS``.

    :returns:
        The sorted cards.

    """
    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
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
Sorts a given list of cards, either by poker ranks, or big two ranks.

    :arg cards:
        The cards to sort.
    :arg dict ranks:
        The rank dict to reference for sorting. If ``None``, it will
        default to ``DEFAULT_RANKS``.

    :returns:
        The sorted cards.