<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _sequence_field(checked_class, item_type, optional, initial):
 """ Create checked field for either ``PSet`` or ``PVector``. :param checked_class: ``CheckedPSet`` or ``CheckedPVector``. :param item_type: The required type for the items in the set. :param optional: If true, ``None`` can be used as a value for this field. :param initial: Initial value to pass to factory. :return: A ``field`` containing a checked class. """

    TheType = _make_seq_field_type(checked_class, item_type)

    if optional:
        def factory(argument):
            if argument is None:
                return None
            else:
                return TheType.create(argument)
    else:
        factory = TheType.create

    return field(type=optional_type(TheType) if optional else TheType,
                 factory=factory, mandatory=True,
                 initial=factory(initial))