<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _set_load_action(self, mem_addr, rec_count, retries, read_complete=False):
 """Calculate the next record to read. If the last record was successful and one record was being read then look for the next record until we get to the high water mark. If the last read was successful and all records were being read then look for the first record. if the last read was unsuccessful and one record was being read then repeat the last read until max retries If the last read was unsuccessful and all records were being read then repeat the last read until max retries or look for the first record. """

        if self._have_all_records():
            mem_addr = None
            rec_count = 0
            retries = 0
        elif read_complete:
            retries = 0
            if rec_count:
                mem_addr = self._next_address(mem_addr)
            else:
                mem_addr = self._next_address(mem_addr)
                rec_count = 1
                retries = 0
        elif rec_count and retries < ALDB_RECORD_RETRIES:
            retries = retries + 1
        elif not rec_count and retries < ALDB_ALL_RECORD_RETRIES:
            retries = retries + 1
        elif not rec_count and retries >= ALDB_ALL_RECORD_RETRIES:
            mem_addr = self._next_address(mem_addr)
            rec_count = 1
            retries = 0
        else:
            mem_addr = None
            rec_count = 0
            retries = 0

        self._load_action = LoadAction(mem_addr, rec_count, retries)
        if mem_addr is not None:
            _LOGGER.debug('Load action: addr: %04x rec_count: %d retries: %d',
                          self._load_action.mem_addr,
                          self._load_action.rec_count,
                          self._load_action.retries)