'Returns a random credit card type instance.'

@classmethod
def _credit_card_type(cls, card_type=None):

    if (card_type is None):
        card_type = cls.random_element(cls.credit_card_types.keys())
    elif isinstance(card_type, CreditCard):
        return card_type
    return cls.credit_card_types[card_type]
