<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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