<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _init(self, state, initiate_arg):
        '''
        Set initial state of the task. Called from initiate.
        @param initiate_arg: either the PartnerClass object (StartTask)
                             or an agent_id (RestartTask)
        '''
        state.descriptor = None
        state.hosts = state.agent.query_partners('hosts')
        state.current_index = -1

        self.log('%s task initiated, will be trying to start a '
                 '%r on one of the hosts: %r', str(self.__class__.__name__),
                 initiate_arg, state.hosts)
        if len(state.hosts) == 0:
            # FIXME: Here would be a good idea to put an alert
            return self._fail('Shard Agent cannot start partner %r as it has '
                              'no Host Partners!' % (initiate_arg, ))