code: def add_sample(self, sample):
      pairs = list(
          map(
              lambda x: (int(x[0]), float(x[1])),
              [pair.split(":", 1) for pair in sample],
          )
      )
  
      for pair in pairs:
          index = pair[0]
          if index >= self.sample_dim:
              raise ValueError(
                  "Invalid sample dimension for input {0}. Max {1}, given {2}".format(
                      self.name, self.sample_dim, index
                  )
              )
  
      byte_size = len(list(pairs)) * (8 if self.is_float() else 12) + 4
  
      if len(self.sequences) == 0:
          self.sequences.append([])
          byte_size += 8
  
      self.sequences[-1].append(pairs)
  
      return byte_size
  
imports: import sys
  import argparse
  import struct
  import os
  from collections import OrderedDict
label_desc: Use image node_id 1 for calling the SparseConverter obj's underlying member method code with example usage: obj.add_sample(sample) and returns: byte_size