<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def initialize_all_switch_interfaces(self, interfaces, switch_ip=None, replay=True):
 """Configure Nexus interface and get port channel number. Called during switch replay or just init if no replay is configured. For latter case, only configured interfaces are affected by this method. During switch replay, the change group from the host mapping data base is used. There is no attempt to relearn port-channel from the Nexus switch. What we last knew it to be will persist. :param interfaces: List of interfaces for a given switch. ch_grp can be altered as last arg to each interface. If no ch_grp, this arg will be zero. :param switch_ip: IP address of Nexus switch :param replay: Whether in replay path """

        if not interfaces:
            return

        starttime = time.time()

        if replay:
            try:
                vpcs = nxos_db.get_active_switch_vpc_allocs(switch_ip)
            except cexc.NexusVPCAllocNotFound:
                vpcs = []
            for vpc in vpcs:
                # if this is an allocated vpc, then recreate it
                if not vpc.learned:
                    self.create_port_channel(switch_ip, vpc.vpc_id)

        for i, (nexus_host, intf_type, nexus_port, is_native,
            ch_grp) in enumerate(interfaces):
            if replay and ch_grp != 0:
                try:
                    vpc = nxos_db.get_switch_vpc_alloc(switch_ip, ch_grp)
                    self.add_ch_grp_to_interface(
                        nexus_host, intf_type, nexus_port, ch_grp)
                except cexc.NexusVPCAllocNotFound:
                    pass
                # if channel-group exists, switch to port-channel
                # instead of the provided ethernet interface
                intf_type = 'port-channel'
                nexus_port = str(ch_grp)

            #substitute content of ch_grp
            no_chgrp_len = len(interfaces[i]) - 1
            interfaces[i] = interfaces[i][:no_chgrp_len] + (ch_grp,)

            trunk_mode_present, vlan_present = (
                self._get_interface_switch_trunk_present(
                    nexus_host, intf_type, nexus_port))
            if not vlan_present:
                self.send_enable_vlan_on_trunk_int(
                    nexus_host, "", intf_type, nexus_port, False,
                    not trunk_mode_present)
            elif not trunk_mode_present:
                LOG.warning(TRUNK_MODE_NOT_FOUND, nexus_host,
                            nexus_help.format_interface_name(
                                intf_type, nexus_port))

        self.capture_and_print_timeshot(
            starttime, "get_allif",
            switch=nexus_host)