code: def decode(self, ctext: T) -> Optional[U]:
      logging.debug("Attempting Morse code decoder")
  
      char_boundary = word_boundary = None
  
      char_boundary = word_boundary = None
      char_priority = word_priority = 0
      # Custom loop allows early break
      for i in ctext:
          i_priority = self.BOUNDARIES.get(i)
          if i_priority is None:
              if i in self.ALLOWED:
                  continue
              logging.debug(f"Non-morse char '{i}' found")
              return None
  
          if (
              i_priority <= char_priority
              or i == char_boundary
              or i == word_boundary
          ):
              continue
          # Default to having a char boundary over a word boundary
          if (
              i_priority > word_priority
              and word_boundary is None
              and char_boundary is not None
          ):
              word_priority = i_priority
              word_boundary = i
              continue
          char_priority = i_priority
          char_boundary = i
  
      logging.debug(
          f"Char boundary is unicode {ord(char_boundary)}, and word boundary is unicode {ord(word_boundary) if word_boundary is not None else None}"
      )
  
      result = ""
  
      for word in (
          ctext.split(word_boundary) if word_boundary else [ctext]
      ):
          logging.debug(f"Attempting to decode word {word}")
          for char in word.split(char_boundary):
              char = char.translate(self.PURGE)
              if len(char) == 0:
                  continue
              try:
                  m = self.MORSE_CODE_DICT_INV[char]
              except KeyError:
                  logging.debug(f"Invalid codeword '{char}' found")
                  return None
              result = result + m
          # after every word add a space
          result = result + " "
      if len(result) == 0:
          logging.debug("Morse code failed to match")
          return None
      # Remove trailing space
      result = result[:-1]
      logging.info(f"Morse code successful, returning {result}")
      return result.strip().upper()
  
file_path: Ciphey/ciphey/basemods/Decoders/morse_code.py
imports: from typing import Dict, Optional
  import logging
  from rich.logging import RichHandler
  from ciphey.iface import Config, Decoder, ParamSpec, T, Translation, U, registry
label_desc: Use image node_id 1 for calling the Morse_code obj's underlying member method code with example usage: obj.decode(ctext) and returns: result, None, None, None