<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def power_factor(self):
 """ Power factor of load Parameters power_factor : :obj:`float` Ratio of real power to apparent power. Returns -------- :obj:`float` Ratio of real power to apparent power. If power factor is not set it is retrieved from the network config object depending on the grid level the load is in. """

        if self._power_factor is None:
            if isinstance(self.grid, MVGrid):
                self._power_factor = self.grid.network.config[
                    'reactive_power_factor']['mv_load']
            elif isinstance(self.grid, LVGrid):
                self._power_factor = self.grid.network.config[
                    'reactive_power_factor']['lv_load']
        return self._power_factor