<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sweep_to_proto_dict(sweep: Sweep, repetitions: int=1) -> Dict: """Converts sweep into an equivalent protobuf representation."""

    msg = {}  # type: Dict
    if not sweep == UnitSweep:
        sweep = _to_zip_product(sweep)
        msg['sweep'] = {
            'factors': [_sweep_zip_to_proto_dict(cast(Zip, factor)) for factor
                        in sweep.factors]
        }
    msg['repetitions'] = repetitions
    return msg