code: def _seq_to_encoded(
      seq: Union[str, Iterable[str]],
      letter_encoder: Dict[str, int],
      alphabet_length: int,
      sequence_length: int,
  ) -> np.ndarray:
      """One hot encodes a genomic sequence.
  
      Sequences encoded have shape (N_sequences, N_letters, sequence_length, 1).
      These sequences will be processed as images with one color channel.
  
      Parameters
      ----------
      seq: str or Bio.SeqRecord
          a genetic sequence
      letter_encoder: Dict[str, int]
          The keys are letters and the values are unique int values (like 0, 1, 2...).
      alphabet_length: int
          Length with the set of possible letters in the sequences.
      sequence_length: int
          Length with a genetic sequence
  
      Returns
      -------
      encoded_seq: np.ndarray
          A numpy array of shape `(N_letters, sequence_length)`.
      """
      encoded_seq = np.zeros((alphabet_length, sequence_length))
      seq_ints = [letter_encoder[s] for s in seq]
      encoded_seq[seq_ints, np.arange(sequence_length)] = 1
      return encoded_seq
  
imports: from typing import Dict, Iterable, Union
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _seq_to_encoded(seq, letter_encoder, alphabet_length, sequence_length) and returns: encoded_seq