code: def fmt_to_datatype_v3(fmt, shape, array=False):
      
      size = fmt.itemsize * 8
  
      if not array and shape[1:] and fmt.itemsize == 1 and fmt.kind == "u":
          data_type = v3c.DATA_TYPE_BYTEARRAY
          for dim in shape[1:]:
              size *= dim
      else:
          if fmt.kind == "u":
              if fmt.byteorder in "=<|":
                  data_type = v3c.DATA_TYPE_UNSIGNED
              else:
                  data_type = v3c.DATA_TYPE_UNSIGNED_MOTOROLA
          elif fmt.kind == "i":
              if fmt.byteorder in "=<|":
                  data_type = v3c.DATA_TYPE_SIGNED
              else:
                  data_type = v3c.DATA_TYPE_SIGNED_MOTOROLA
          elif fmt.kind == "f":
              if fmt.byteorder in "=<":
                  if size == 32:
                      data_type = v3c.DATA_TYPE_FLOAT
                  else:
                      data_type = v3c.DATA_TYPE_DOUBLE
              else:
                  if size == 32:
                      data_type = v3c.DATA_TYPE_FLOAT_MOTOROLA
                  else:
                      data_type = v3c.DATA_TYPE_DOUBLE_MOTOROLA
          elif fmt.kind in "SV":
              data_type = v3c.DATA_TYPE_STRING
          elif fmt.kind == "b":
              data_type = v3c.DATA_TYPE_UNSIGNED
              size = 1
          else:
              message = f"Unknown type: dtype={fmt}, shape={shape}"
              logger.exception(message)
              raise MdfException(message)
  
      return data_type, size
docs: convert numpy dtype format string to mdf versions 2 and 3
      channel data type and size
  
      Parameters
      ----------
      fmt : numpy.dtype
          numpy data type
      shape : tuple
          numpy array shape
      array : bool
          disambiguate between bytearray and channel array
  
      Returns
      -------
      data_type, size : int, int
          integer data type as defined by ASAM MDF and bit size