docs: def decode(self, message, ecc, k=None, enable_erasures=False, erasures_char="\x00", only_erasures=False):
          '''Repair a message and its ecc also, given the message and its ecc (both can be corrupted, we will still try to fix both of them)'''
          if not k: k = self.k
  
          # Optimization, use bytearray
          if isinstance(message, _str):
              message = bytearray([ord(x) for x in message])
              ecc = bytearray([ord(x) for x in ecc])
  
          # Detect erasures positions and replace with null bytes (replacing erasures with null bytes is necessary for correct syndrome computation)
          # Note that this must be done before padding, else we risk counting the padded null bytes as erasures!
          erasures_pos = None
          if enable_erasures:
              # Concatenate to find erasures in the whole codeword
              mesecc = message + ecc
              # Convert char to a int (because we use a bytearray)
              if isinstance(erasures_char, _str): erasures_char = ord(erasures_char)
              # Find the positions of the erased characters
              erasures_pos = [i for i in xrange(len(mesecc)) if mesecc[i] == erasures_char]
              # Failing case: no erasures could be found and we want to only correct erasures, then we return the message as-is
              if only_erasures and not erasures_pos: return message, ecc
  
          # Pad with null bytes if necessary
          message, pad = self.pad(message, k=k)
          ecc, _ = self.rpad(ecc, k=k) # fill ecc with null bytes if too small (maybe the field delimiters were misdetected and this truncated the ecc? But we maybe still can correct if the truncation is less than the resilience rate)
  
          # If the message was left padded, then we need to update the positions of the erasures
          if erasures_pos and pad:
              len_pad = len(pad)
              erasures_pos = [x+len_pad for x in erasures_pos]
  
          # Decoding
          if self.algo == 1:
              msg_repaired, ecc_repaired = self.ecc_manager.decode(message + ecc, nostrip=True, k=k, erasures_pos=erasures_pos, only_erasures=only_erasures) # Avoid automatic stripping because we are working with binary streams, thus we should manually strip padding only when we know we padded
          elif self.algo == 2:
              msg_repaired, ecc_repaired = self.ecc_manager.decode_fast(message + ecc, nostrip=True, k=k, erasures_pos=erasures_pos, only_erasures=only_erasures)
          elif self.algo == 3:
              #msg_repaired, ecc_repaired = self.ecc_manager.decode_fast(message + ecc, nostrip=True, k=k, erasures_pos=erasures_pos, only_erasures=only_erasures)
              msg_repaired, ecc_repaired = reedsolo.rs_correct_msg_nofsynd(bytearray(message + ecc), self.n-k, fcr=self.fcr, generator=self.gen_nb, erase_pos=erasures_pos, only_erasures=only_erasures)
              msg_repaired = bytearray(msg_repaired)
              ecc_repaired = bytearray(ecc_repaired)
          elif self.algo == 4:
              msg_repaired, ecc_repaired = reedsolo.rs_correct_msg(bytearray(message + ecc), self.n-k, fcr=self.fcr, generator=self.gen_nb, erase_pos=erasures_pos, only_erasures=only_erasures)
              msg_repaired = bytearray(msg_repaired)
              ecc_repaired = bytearray(ecc_repaired)
  
          if pad: # Strip the null bytes if we padded the message before decoding
              msg_repaired = msg_repaired[len(pad):len(msg_repaired)]
          return msg_repaired, ecc_repaired