<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def with_cardinality(cls, cardinality, converter, pattern=None, listsep=','):
 """Creates a type converter for the specified cardinality by using the type converter for T. :param cardinality: Cardinality to use (0..1, 0..*, 1..*). :param converter: Type converter (function) for data type T. :param pattern: Regexp pattern for an item (=converter.pattern). :return: type-converter for optional<T> (T or None). """

        if cardinality is Cardinality.one:
            return converter
        # -- NORMAL-CASE
        builder_func = getattr(cls, "with_%s" % cardinality.name)
        if cardinality is Cardinality.zero_or_one:
            return builder_func(converter, pattern)
        else:
            # -- MANY CASE: 0..*, 1..*
            return builder_func(converter, pattern, listsep=listsep)