Converts sweep into an equivalent protobuf representation.

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