<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_cards(cards, filename=None):
 """ Save the given cards, in plain text, to a txt file. :arg cards: The cards to save. Can be a ``Stack``, ``Deck``, or ``list``. :arg str filename: The filename to use for the cards file. If no filename given, defaults to "cards-YYYYMMDD.txt", where "YYYYMMDD" is the year, month, and day. For example, "cards-20140711.txt". """

    filename = filename or "cards-%s.txt" % (time.strftime("%Y%m%d"))

    with open(filename, "w") as deck_file:
        card_reprs = ["%s %s\n" % (card.value, card.suit) for card in cards]
        card_reprs[-1] = card_reprs[-1].rstrip("\n")
        for card in card_reprs:
            deck_file.write(card)