docs: def scramble_itemdata(self, oid, value):
          """If metadata provided, use it to scramble the value based on data type"""
          if self.metadata is not None:
              path = ".//{0}[@{1}='{2}']".format(E_ODM.ITEM_DEF.value, A_ODM.OID.value, oid)
              elem = self.metadata.find(path)
              # for elem in self.metadata.iter(E_ODM.ITEM_DEF.value):
              datatype = elem.get(A_ODM.DATATYPE.value)
  
              codelist = None
              for el in elem.iter(E_ODM.CODELIST_REF.value):
                  codelist = el.get(A_ODM.CODELIST_OID.value)
  
              length = 1 if not A_ODM.LENGTH in elem else int(elem.get(A_ODM.LENGTH.value))
  
              if A_ODM.SIGNIFICANT_DIGITS.value in elem.keys():
                  sd = elem.get(A_ODM.SIGNIFICANT_DIGITS.value)
              else:
                  sd = 0
  
              if A_ODM.DATETIME_FORMAT.value in elem.keys():
                  dt_format = elem.get(A_ODM.DATETIME_FORMAT.value)
                  for fmt in [('yyyy', '%Y'), ('MMM', '%b'), ('dd', '%d'), ('HH', '%H'), ('nn', '%M'), ('ss', '%S'),
                              ('-', '')]:
                      dt_format = dt_format.replace(fmt[0], fmt[1])
  
              if codelist is not None:
                  return self.scramble_codelist(codelist)
  
              elif datatype == 'integer':
                  return self.scramble_int(length)
  
              elif datatype == 'float':
                  return self.scramble_float(length, sd)
  
              elif datatype in ['string', 'text']:
                  return self.scramble_string(length)
  
              elif datatype in ['date', 'datetime']:
                  return self.scramble_date(value, dt_format)
  
              elif datatype in ['time']:
                  return self.scramble_time(dt_format)
  
              else:
                  return self.scramble_value(value)
  
          else:
              return self.scramble_value(value)