code: def check_sorted(cards, ranks=None):
      
      ranks = ranks or DEFAULT_RANKS
  
      sorted_cards = sort_cards(cards, ranks)
  
      if cards == sorted_cards or cards[::-1] == sorted_cards:
          return True
      else:
          return False
docs: Checks whether the given cards are sorted by the given ranks.
  
      :arg cards:
          The cards to check. Can be a ``Stack``, ``Deck``, or ``list`` of
          ``Card`` isntances.
      :arg dict ranks:
          The ranks to check against. Default is DEFAULT_RANKS.
  
      :returns:
          ``True`` or ``False``.