def format_card(card_num):
    """
    Formats card numbers to remove any spaces, unnecessary characters, etc

    Input: Card number, integer or string
    Output: Correctly formatted card number, string
    """
    import re
    card_num = str(card_num)
    return re.sub('\\D', '', card_num)
