<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getV0(self, v_mag_guess, buses, generators, type=CASE_GUESS):
 """ Returns the initial voltage profile. """

        if type == CASE_GUESS:
            Va = array([b.v_angle * (pi / 180.0) for b in buses])
            Vm = array([b.v_magnitude for b in buses])
            V0 = Vm * exp(1j * Va)
        elif type == FLAT_START:
            V0 = ones(len(buses))
        elif type == FROM_INPUT:
            V0 = v_mag_guess
        else:
            raise ValueError

        # Set the voltages of PV buses and the reference bus in the guess.
#        online = [g for g in self.case.generators if g.online]
        gbus = [g.bus._i for g in generators]
        Vg = array([g.v_magnitude for g in generators])

        V0[gbus] = Vg * abs(V0[gbus]) / V0[gbus]

        return V0