<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rectify_acquaintance_strategy( circuit: circuits.Circuit, acquaint_first: bool=True ) -> None: """Splits moments so that they contain either only acquaintance gates or only permutation gates. Orders resulting moments so that the first one is of the same type as the previous one. Args: circuit: The acquaintance strategy to rectify. acquaint_first: Whether to make acquaintance moment first in when splitting the first mixed moment. """


    if not is_acquaintance_strategy(circuit):
        raise TypeError('not is_acquaintance_strategy(circuit)')

    rectified_moments = []
    for moment in circuit:
        gate_type_to_ops = collections.defaultdict(list
                ) # type: Dict[bool, List[ops.GateOperation]]
        for op in moment.operations:
            gate_type_to_ops[isinstance(op.gate, AcquaintanceOpportunityGate)
                    ].append(op)
        if len(gate_type_to_ops) == 1:
            rectified_moments.append(moment)
            continue
        for acquaint_first in sorted(gate_type_to_ops.keys(),
                                     reverse=acquaint_first):
            rectified_moments.append(
                    ops.Moment(gate_type_to_ops[acquaint_first]))
    circuit._moments = rectified_moments